0
I'm currently trying to do one thing in matlab. The situation is simple: I have about 70 3-dimensional matrices of the same size (192 x 192 x 30). What I need to obtain are vectors created from values of the same index from these matrices. It will be easier to provide you with a simple example (with 2D matrices):
For the case of 70 3D matrices (of a size: 192x192x30), the output would be a matrix with 70 columns and 192x192x30 rows. I'm wondering about the simplest possible solution by working only with matrices, and no for loops. The final solution in the case of 70 matrices would look sth like:
Thank you in advice for any help. I'm aware that the solution in matlab is probably a very simple one, but I had a problem finding it.
Greetings!
A solution with the use of loops would be easy to implement, but with so many cells, even for two arrays it takes a lot of time to run (example for two arrays below).
`function output = createMatrixFromFrames(x,y)
xIndex = 192; yIndex = 192; zIndex = 30; output = [0 0];
for xParam = 1:xIndex disp(xParam); for yParam = 1:yIndex for zParam = 1:zIndex output = [output; x(xParam,yParam,zParam) y(xParam,yParam,zParam)]; end end end` – Piotr Kopczyński – 2017-02-23T20:21:46.610