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?
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:2| Question number:21.2
All Answers
total answers (1)
>> 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