The problem is:
Product of known dimensions, 3, not divisible into total number of elements, 16.
this because i want to reshape
a
You can use vec2mat that's part of the Communications System Toolbox, assuming A
as the input vector -
ncols = 6; %// number of columns needed in the output
out = vec2mat(A,ncols)
Sample run -
>> A'
ans =
4 9 8 9 6 1 8 9 7 7 7 4 6 2 7 1
>> out
out =
4 9 8 9 6 1
8 9 7 7 7 4
6 2 7 1 0 0
If you don't have that toolbox, you can work with the basic functions to achieve the same -
out = zeros([ncols ceil(numel(A)/ncols)]);
out(1:numel(A)) = A;
out = out.'