using FIND in 3D matrix
1 回表示 (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
その他の回答 (2 件)
Sean de Wolski
2013 年 5 月 29 日
I would do that like this:
A(:,:,1)=[1 2 ; 3 4];
A(:,:,2)=[9 8 ; 4 4];
A(:,:,3)=[2 4 ; 7 4];
A(:,:,4)=A(:,:,1);
B=[1 2 ; 3 4];
idx = find(all(all(bsxfun(@eq,A,B),1),2))
Find where all elements in rows/cols are equal in pages
2 件のコメント
Andrei Bobrov
2013 年 5 月 29 日
[ii,jj]=ismember(reshape(A,[],size(A,3))',B(:)','rows');
out = jj(ii);
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!