Documentation Center

  • Trial Software
  • Product Updates

shiftdim

Class: categorical

Shift dimensions of categorical array

The nominal and ordinal array data types might be removed in a future release. To represent ordered and unordered discrete, nonnumeric data, use the MATLAB® categorical data type instead.

Syntax

B = shiftdim(A,n)
[B,nshifts] = shiftdim(A)

Description

B = shiftdim(A,n) shifts the dimensions of the categorical array A by N. When n is positive, shiftdim shifts the dimensions to the left and wraps the n leading dimensions to the end. When n is negative, shiftdim shifts the dimensions to the right and pads with singletons.

[B,nshifts] = shiftdim(A) returns the array B with the same number of elements as A but with any leading singleton dimensions removed. nshifts returns the number of dimensions that are removed. If A is a scalar, shiftdim has no effect.

See Also

| |

Was this topic helpful?