Documentation Center

  • Trial Software
  • Product Updates


Class: categorical

Number of 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.


n = ndims(A)


n = ndims(A) returns the number of dimensions in the categorical array A. The number of dimensions in an array is always greater than or equal to 2. Trailing singleton dimensions are ignored. Put simply, ndims(A) is length(size(A)).

See Also

Was this topic helpful?