How to compare two matrix?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Md Jahid Hasan Sagor
le 26 Avr 2023
Commenté : Md Jahid Hasan Sagor
le 27 Avr 2023
Suppose,
A=[4 5;4 19;5 7;4 5];
B=[4 5]
if B in A
calculation1;
end
else
calculation2;
end
How Can I code this?
0 commentaires
Réponse acceptée
Plus de réponses (1)
Juan Ruiz Osorio
le 26 Avr 2023
Modifié(e) : Juan Ruiz Osorio
le 26 Avr 2023
I think this works if you want to do a calculation for each member of B.
A=[4 5;4 19;5 7;4 5];
B=[4 5];
for i=1:size(B,2)
if ismember(B(i),A)
calculation1;
else
calculation2;
end
end
0 commentaires
Voir également
Catégories
En savoir plus sur Dynamic System Models dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!