x2 = zeros(60, 46000, 'single');for N = 1:46000x2(:,N) = x(:,i(N),N);end
Hi. I have a 3D matrix x with the dimensions 60x100x40000 and a 1×46000 vector i with an index for each matrix in the 3rd dimension telling me which columns I need to extract (The values for i are between 1 & 100). So ultimately, I would like to end up with a 60×40000 matrix, using i to extract from x.
My solution so far can be seen above. It works, but takes forever (especially since I have to repeat the process almost 100 times. Does anyone know of a direct way I can do this?
Thanks!
Best Answer