I have a 3D array of size(N,N,sz). I want to create a 2D array of size(N,sz) where the columns of the 2D array correspond to the first column from every sz-th array from the 3D array. I have tried the following but there is a "Subscripted assignment dimension mismatch" as an error:
2Darray=permute(3Darray,[1 3 2]); 2Darray=reshape(2Darray, [], size(3Darray,2),1); for m=1:1:sz 2Darray(:,m)=3Darray(:,1,m) end
Best Answer