I have a list of objects in matrix A and object list and their corresponding masses in matrix B.Howto generate a matrix containing masses of objects present in orderof matrxA
2 ビュー (過去 30 日間)
古いコメントを表示
A = ["C"; "A"; "E"; "F"; "I"]
B = ["A", 1;"B", 34;"C" 56;"D" 32;"E",11;"F",8;"G", 7;"H",9;"I" 77]
0 件のコメント
採用された回答
Voss
2023 年 1 月 31 日
A = ["C"; "A"; "E"; "F"; "I"]
B = ["A", 1;"B", 34;"C" 56;"D" 32;"E",11;"F",8;"G", 7;"H",9;"I" 77]
[ism,idx] = ismember(A,B(:,1));
assert(all(ism))
result = B(idx,:)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!