MATLAB Function Reference
  Go to function:
    Search    Help Desk 
squeeze    Examples   See Also

Remove singleton dimensions

Syntax

Description

B = squeeze(A) returns an array B with the same elements as A, but with all singleton dimensions removed. A singleton dimension is any dimension for which
size(A,dim) = 1.

Examples

Consider the 2-by-1-by-3 array Y = rand(2,1,3). This array has a singleton column dimension -- that is, there's only one column per page.

The command Z = squeeze(Y) yields a 2-by-3 matrix:

See Also

reshape     Reshape array

shiftdim    Shift dimensions



[ Previous | Help Desk | Next ]