Documentation Center

  • Trial Software
  • Product Updates

reshape

Class: categorical

Resize 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 = reshape(A,M,N)
B = reshape(A,m,n,p,...)
reshape(A,[m n p ...])
B = reshape(A,...,[],...)

Description

B = reshape(A,M,N) returns an m-by-n categorical matrix whose elements are taken columnwise from the categorical array A. An error results if A does not have m*n elements.

B = reshape(A,m,n,p,...) or reshape(A,[m n p ...]) returns an array with the same elements as A but reshaped to have the size m-by-n-by-p-by-... . m*n*p*... must be the same as numel(A).

B = reshape(A,...,[],...) calculates the length of the dimension represented by[], such that the product of the dimensions equals numel(A). numel(A) must be evenly divisible by the product of the known dimensions. You can use only one occurrence of [].

In general, reshape(A,siz) returns an array with the same elements as A but reshaped to the size siz. prod(siz) must be the same as numel(A).

See Also

|

Was this topic helpful?