How can I compare the user input value in a given matrix.
Ältere Kommentare anzeigen
b=[ 10 32 54 76 -25
20 60 100 140 -51
45 135 -135 -45 59]
b1=input(' b1= ');
b2=input('b2= ');
b3=input('b3= ');
b4=input('b4= ');
if (b1==b(1)||b(6)||b(11))&&(b2==b(2)||b(7)||b(12))&&(b3==b(3)||b(8)||b(13))&&(b4==b(4)||b(9)||b(14))
disp('MATCH FOUND');
else
disp('MATCH NOT FOUND');
end
1 Kommentar
jgg
am 9 Jan. 2016
I'm pretty sure your issue is that your or conditions are not written properly. Write them as full conditions.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!