Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

rot90 - Rotate matrix 90 degrees

Syntax

B = rot90(A)
B = rot90(A,k)

Description

B = rot90(A) rotates matrix A counterclockwise by 90 degrees.

B = rot90(A,k) rotates matrix A counterclockwise by k*90 degrees, where k is an integer.

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

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS