Need an IF boolean that compares a number to all numbers in an array
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
Hello
a = [1,2,3]
b=2
if b is in a
do this
end
How do i do it?
Antworten (1)
a = [1,2,3];
b = 2;
if any(b==a)
disp('b in a')
else
disp('b not in a')
end
Also, see the help for ISMEMBER. In this case it is not needed.
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!