Scilab-Branch-6.1-GIT
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
squeeze
removes singleton dimensions of a ND-array
Syntax
r = squeeze(hypIn)
Arguments
- hypIn
a ND-array of any native type (boolean, .., cells, structures)
- r
an array or ND-array of the same type.
Description
squeeze(…)
removes singleton dimensions of an hypermatrix or ND-array,
that is any dimension for which the size is 1
.
If the input hypIn
is a matrix, it is returned as is.
Scilab squeezes highest singleton dimensions automatically. |
Examples
// For 2D input matrices => no action u = squeeze(ones(1,4)) size(u) // auto-squeezing of highest singleton dimensions: v = ones(2,3,1,1); size(v) // For an actual input ND-array: w = squeeze(ones(1,3,1,4)) size(w) // for a 4D-array of cells c = cat(4, {%t}, {%pi}, {"abc"}); size(c) x = squeeze(c) size(x)
--> u = squeeze(ones(1,4)) u = 1. 1. 1. 1. --> size(u) ans = 1. 4. --> // auto-squeezing of highest singleton dimensions: --> v = ones(2,3,1,1); --> size(v) ans = 2. 3. --> // For an actual input ND-array: --> w = squeeze(ones(1,3,1,4)) w = 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. --> size(w) ans = 3. 4. --> // for a 4D-array of cells --> c = cat(4, {%t}, {%pi}, {"abc"}); --> size(c) ans = 1. 1. 1. 3. --> x = squeeze(c) x = [1x1 boolean ] [1x1 constant] [1x1 string ] --> size(x) ans = 3. 1.
See also
- matrix — reshapes an array with the same number and order of components
- hypermatrices — a Scilab object, N dimensional matrix in Scilab
Report an issue | ||
<< resize_matrix | Matrix - shaping | tril >> |