squeeze#
Remove inner and outer singleton dimensions from a matrix.
Available in: math cells, REPL.
Syntax#
squeeze(x)
Arguments and behavior#
For matrices, dimensions must match the operation. Singular matrices or incompatible shapes can fail. Cell indexing starts at 1. The example returns matrix.
Example#
Edit the inputs, then use Run or Reset. Changes stay in this example.
Example
a = zeros(3,2,1)
size(squeeze(a))Interactive examples could not load. You can still copy the expressions.
Expected result: matrix.
See also#
concat · det · diag · identity · inv · ones · range · size · subset · trace · transpose · zeros