MATLAB: How to index a 3D array like A(n,m,:) and get the result as a 1D array

indexingMATLAB

Hi
Assume we have a 3D array like this (image from the manual):
In python/numpy I can something similar to
B = A(2,3,:)
which gets me B as a 1D array with: B = [A(2,3,1), A(2,3,2) , A(2,3,3)]
Can I do something similar (as simple) in matlab without going to e.g. linear indexing?

Best Answer

B = reshape(A(2,3,:),1,[])