Find elements from a submatrix in the main 3D matrix

4 ビュー (過去 30 日間)
Bianca Brisc
Bianca Brisc 2021 年 7 月 20 日
コメント済み: Matt J 2021 年 7 月 21 日
Hello.
I have a matrix M = 10x5. 10 representing the number of users and 5 the values for each user. This is taken out of the bigger matrix A = 161x161x10. 10 again being the same number of users as in the M matrix. The values from M are in A.
My main goal is to find the indexes (or ROW,COL) from the values from matrix M in matrix A. The problem is that because in M , I have duplicate values I can't find use the FIND function. Based on my research I did not found something helpful.
Do you think is possible to do this? Thank you!

採用された回答

Matt J
Matt J 2021 年 7 月 20 日
[row,col]=find( reshape( ismember(M(:),A(:)) , size(M) ) );
  6 件のコメント
Bianca Brisc
Bianca Brisc 2021 年 7 月 21 日
@Matt J Thank you very much! I could not make it work with row and col but I am finding the indexes and then I will convert into row and column. The only problem is when the indexes are added to the cell they are added in ascending order which for my case is not the ideal case but I think I can sort it out somehow.
Thank you for the answers. If you have any more suggestions, I am happy to read them!
Matt J
Matt J 2021 年 7 月 21 日
You're welcome, but please Accept-click the answer if you have what you need.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by