rot90
Rotate array 90 degrees.
📝Syntax
B = rot90(A)
B = rot90(A, k)
📥Input Arguments
Parameter Description
A an array: numeric, logical, character, string, cell, structure, or sparse.
k an integer scalar value: Rotation constant.
📤Output Arguments
Parameter Description
B rotated array.
📄Description

B = rot90(A, k) rotates array A counter clockwise by k * 90 degrees, where k is an integer scalar value. Negative values rotate clockwise.

The result preserves the input class and sparse storage when applicable.

Considerflip function to flip arrays in any dimension.

💡Examples
x = eye(3, 2);
y = rot90(x, 0)
y = rot90(x, 1)
y = rot90(x, 2)
y = rot90(x, 3)
🔗See Also
flipudfliplr
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub