MATLAB: Using FIND in 3D matrix

findmatrix matchingmultidimensional array

I am trying to find the 3rd dimension index value for the following case
A(:,:,1)=[1 2 ; 3 4]
A(:,:,2)=[9 8 ; 4 4]
A(:,:,3)=[2 4 ; 7 4]
B=[1 2 ; 3 4]
How can I use find(.) for this purpose

Best Answer

idx=find(arrayfun(@(x) isequal(A(:,:,x),B),1:size(A,3)))
Related Question