squeeze {matlab2r} | R Documentation |
Squeeze
Description
Remove dimensions of length 1
Usage
squeeze(A)
Arguments
A |
input or array matrix |
Details
This function implements the behavior of the homonimous function on
Matlab. B = squeeze(A)
returns an array with the same elements as the
input array A, but with dimensions of length 1 removed. For example, if A is
a 3-by-1-by-1-by-2 array, then squeeze(A) returns a 3-by-2 matrix. If A is a
row vector, column vector, scalar, or an array with no dimensions of length
1, then squeeze returns the input A.
Value
An array with the same elements as the input array, but with dimensions of length 1 removed.
Note
This is basically a wrapper of drop() with a minor adjustment to adapt the output to what happens on Matlab
Author(s)
Waldir Leoncio
Examples
A <- array(dim = c(2, 1, 2))
A[, , 1] <- c(1, 2)
A[, , 2] <- c(3, 4)
print(A)
squeeze(A)
[Package matlab2r version 1.5.0 Index]