plato/matrix_reshape.m

8 lines
124 B
Matlab

clear
v = 1:12;
% reshape v as 4x3 matrix
M = reshape(v, [4,3]);
% note: M(:) is a column vector
assert(all(M(:) == v.'));