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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Voss
am 31 Jan. 2023
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,:)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!