search for a value in one matrix in another matrix
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Berfin Çetinkaya
am 29 Mär. 2022
Kommentiert: Voss
am 30 Mär. 2022
Hi everybody
Matrix A:
16 14 12 10 18
Matrix B:
2
3
5
4
1
new matrix :
2 14
3 12
5 18
4 10
1 16
For example, since 2 is written in matrix B, it prints the second row value in A next to 2 in the new matrix.
I need such a matrix. Could you help?
Thank u
0 Kommentare
Akzeptierte Antwort
Voss
am 29 Mär. 2022
% Matrix A:
A = [16 14 12 10 18];
% Matrix B:
B = [2; 3; 5; 4; 1];
% new matrix :
new_matrix = [B A(B).']
5 Kommentare
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!