How to generate an array based on the values of another array?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Weimar Yamit Castellanos Cardona
il 25 Ott 2022
Commentato: Weimar Yamit Castellanos Cardona
il 26 Ott 2022
%Assign values ex: 2 becomes 4, 1 becomes 3, 3 becomes 2.....
A=[2 4;
1 3;
3 2;
4 1 ]
%Replace the new mappings at each position in the following array...ex:
B=[1 3;
3 1;
2 4;
4 3 ]
%New array generated C:
C=[3 2;
2 3;
4 1;
1 2 ]
Risposta accettata
KALYAN ACHARJYA
il 25 Ott 2022
Modificato: KALYAN ACHARJYA
il 25 Ott 2022
A=[1 3;3 1;2 4;4 3]
B=A;
A(B==2)=4;
A(B==1)=3;
A(B==3)=2;
A(B==4)=1;
A
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Types in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!