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

1 回表示 (過去 30 日間)
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 ]

採用された回答

Matt J
Matt J 2022 年 5 月 22 日
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"

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by