MATLAB: Changing format/size of matrix in table

columndisplayformatematrixrowsize;table

I have a 1071×1 matrix right now, the values are distances from a specific point to every coordinates in a 20×50 floor plan
How can i turn the 1071×1 table into a 21×51 ones?
I have tried to make them into different rows then combining them but…………
compwidth=50;
compdepth=20;
Xo = 25;
Yo = 10;
Origin=[Xo, Yo];
x = 0:compwidth;
y = 0:compdepth;
[X,Y] = ndgrid(x,y);
XY = [X(:), Y(:)];
%disp(XY);
AB=[((X(:)-Xo).^2 + (Y(:)-Yo).^2).^0.5];
for i=1:(compdepth+1)
Row(i)= AB((i+(i-1)*compwidth):(compwidth*i+1))';
i=i+1;
end

Best Answer

AB=[((X(:)-Xo).^2 + (Y(:)-Yo).^2).^0.5];
outDouble3d = permute(reshape(AB.',51,21,[]),[2 1 3]);
%found it in another Q&A
Related Question