reshape
Reshapes a vector or a matrix to a different size matrix.
📝Syntax
M2 = reshape(M1, s1, ... ,sN)
M2 = reshape(M1, ..., [], ...)
M2 = reshape(M1, size)
📥Input Arguments
Parameter Description
M1 a vector or an matrix
size a size vector
s1, ... ,sN a s1 - by - ... - by - sN array where s1, ..., sN indicates the size of each dimension.
📤Output Arguments
Parameter Description
M2 Matrix reshaped
📄Description

reshape performs a reshape to a different size matrix. If only one dimension is specified, reshape will determine complementary size automatically. [ ] is used to unspecify the dimension.

💡Examples
M1 = ones(3, 4, 5);
M2 = reshape(M1, [5, 3, 4])
M2 = reshape(M1, 5, [], 4)
🔗See Also
colon
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub