Dear all, I have a 8X8X8 three dimensional matrix. I would like to create 512X4 matrix so that first column give the position of x, second column the position of y and third one for z position.
I have a code like this
nx = size(dyzw,1);ny = size(dyzw,2);nz = size(dyzw,1);N = nx*ny*nz;bigData = dyzw(:);bigMatrix = zeros(N, 4);for i = 1: N bigMatrix(i,4) = bigData(i); for j = 1: nx for k = 1: ny for l = 1:nz bigMatrix(i,1) =j; bigMatrix(i,2) =k; bigMatrix(i,3) =l; end end endend
But I failed to produce the matrix as I want. Could you please check my code please.
Thanks
Best Answer