squeeze

Removes singular dimensions from a matrix.

Syntax

R = squeeze(A)

Inputs

A
Any valid scalar | vector | matrix.
Type: double | int | log
Dimension: scalar | vector | matrix

Outputs

R
The squeezed matrix.

Examples

Conventional case:

R = squeeze(ones(1,2,1,1,3))
R = [Matrix] 2 x 3
1  1  1
1  1  1

Row vector case case (see Comments):

R = squeeze(ones(1,3))
R = [Matrix] 1 x 3
1  1  1

Comments

By convention, the function preserves row vectors. Hence, the function will only alter matrices with more than two dimensions.