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
1 次查看(过去 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 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!