Quantcast

Documentation Center

  • Trial Software
  • Product Updates

size

Class: categorical

Size 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

d = size(A)
[m,n] = size(A)
[m1,m2,m3,...,mn] = size(A)
m = size(A,dim)

Description

d = size(A) returns the two-element row vector d = [m,n] containing the number of rows and columns in the matrix for an m-by-n categorical matrix A. For n-D categorical arrays, size(A) returns a 1-by-n vector of dimension lengths. Trailing singleton dimensions are ignored.

[m,n] = size(A) for a categorical matrix A, returns the number of rows and columns in A as separate output variables.

[m1,m2,m3,...,mn] = size(A), for n>1, returns the sizes of the first n dimensions of the categorical array A. If the number of output arguments n does not equal ndims(A), then for:

n > ndims(A)size returns ones in the "extra" variables, i.e., outputs ndims(A)+1 through n.
n < ndims(A)mn contains the product of the sizes of dimensions n through ndims(A).

m = size(A,dim) returns the length of the dimension specified by the scalar dim. For example, size(A,1) returns the number of rows. If dim > ndims(A), m will be 1.

See Also

| |

Was this topic helpful?