Q:

Create a 2 x 3 matrix variable mat. Pass this matrix variable to each of the following functions and make sure you understand the result: flip, fliplr, flipud, and rot90. In how many different ways can you reshape it?

0

Create a 2 x 3 matrix variable mat. Pass this matrix variable to each of the following functions and make sure you understand the result: flip, fliplr, flipud, and rot90. In how many different ways can you reshape it?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

>> mat = randi([1,20], 2,3)

mat =

 16 5 8

 15 18 1

>> flip(mat)

ans =

 15 18 1

 16 5 8

>>fliplr(mat)

ans =

 8 5 16

 1 18 15

>> flipud(mat)

ans =

 15 18 1

 16 5 8

>> rot90(mat)

ans =

 8 1

 5 18

 16 15

>> rot90(rot90(mat))

ans =

 1 18 15

 8 5 16

>> reshape(mat,3,2)

ans =

 16 18

 15 8

 5 1

>> reshape(mat,1,6)

ans =

 16 15 5 18 8 1

>> reshape(mat,6,1)

ans =

 16

 15

 5

 18

 8

 1

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now