resize
Resize an array by truncating or padding.
📝Syntax
B = resize(A, m)
B = resize(A, sz)
B = resize(A, sz, 'FillValue', v)
📥Input Arguments
Parameter Description
A the array to resize.
m a scalar length, used to resize a vector.
sz a size vector [m n ...] giving the size of the result.
v the value used to fill added elements (default 0 for a numeric array).
📤Output Arguments
Parameter Description
B the resized array, of the requested size and the class of A.
📄Description

resize returns an array of the requested size. Along each dimension, elements of A beyond the new size are dropped and positions beyond the original data are filled with a fill value, which is 0 for a numeric array unless 'FillValue' is given. A scalar size resizes the length of a vector and keeps its orientation.

💡Examples
resize([1 2 3], 6)
🔗See Also
reshape
🕔Version History
Version Description
2.0.0 Initial version.
Edit this page on GitHub