Navigation

Operators and Keywords

Function List:

C++ API

: rotdim (x)
: rotdim (x, n)
: rotdim (x, n, plane)

Return a copy of x with the elements rotated counterclockwise in 90-degree increments.

The second argument n is optional, and specifies how many 90-degree rotations are to be applied (the default value is 1). Negative values of n rotate the matrix in a clockwise direction.

The third argument is also optional and defines the plane of the rotation. If present, plane is a two element vector containing two different valid dimensions of the matrix. When plane is not given the first two non-singleton dimensions are used.

For example,

rotdim ([1, 2; 3, 4], -1, [1, 2])
     ⇒  3  1
         4  2

rotates the given matrix clockwise by 90 degrees. The following are all equivalent statements:

rotdim ([1, 2; 3, 4], -1, [1, 2])
rotdim ([1, 2; 3, 4], 3, [1, 2])
rotdim ([1, 2; 3, 4], 7, [1, 2])

See also: rot90, fliplr, flipud, flip.

Package: octave