Rotate matrix 90°
Syntax
B = rot90(A) B = rot90(A,k)
Description
B = rot90(A) rotates matrix A counterclockwise by 90 degrees.
B = rot90(A)
A
B = rot90(A,k) rotates matrix A counterclockwise by k*90 degrees, where k is an integer.
B = rot90(A,k)
k*90
k
Examples
The matrix
X = 1 2 3 4 5 6 7 8 9
rotated by 90 degrees is
Y = rot90(X) Y = 3 6 9 2 5 8 1 4 7
See Also
flipdim, fliplr, flipud
flipdim
fliplr
flipud