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

1 visualización (últimos 30 días)
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 ]

Respuesta aceptada

Matt J
Matt J el 22 de Mayo de 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"

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by