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 CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by