I want to extract a 2D matrix from a 3D matrix. Now, I know how to do it with
A = ones(10,10,10);
B = squeeze(A(:,:,2));
But I want to write a function which will get as inputs the 3D matrix, and the dimension and index where to get the 2D matrix. In the example above, this would give:
B = my_func(A,3,2);
Any ideas?
Thanks a lot!