I want to compare each element in 2 matrix same size and display a text in every case.

1 vue (au cours des 30 derniers jours)
i want to compare 2 matrix lets say A=[1 2 3 4 5] and B=[2 4 9 8 2 ] and if elemnt A<B then display a custom text
like this
[ yes yes yes yes no ]

Réponse acceptée

Matt J
Matt J le 22 Mai 2022
A=[1 2 3 4 5];
B=[2 4 9 8 2 ];
t=["no", "yes"];
t((A<B)+1)
ans = 1×5 string array
"yes" "yes" "yes" "yes" "no"

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by