MATLAB: Create Matrix using loop

loopmatrix

I have a data file containing 2,239,488 values. I need to arrange these values in a 108*108*192 matrix. The data file is arranged in such matter (0,0,0),(1,0,0),(2,0,0)….(107,0,0),(0,1,0),(2,1,0)…(107,1,0),(0,2,0),(1,2,0)…….(107,107,191). i.e. my x coordinates runs fasters (inner loop) and the y in the middle loop and finally z is the outer loop until Ive exhausted the 108*108*192 numbers.
Is there a function or code to take my data file and arrange in such matrix?
Thanks, Sydney

Best Answer

Look at reshape() function.
reshape(yourMatrix,108,108,192);