enter in the if clause only in certain situation
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
I would execute a block only if I have this vector
A=[1 0]
instead if I'd have A=[0 0] or A=[1 1] if clause shouldn't be executed. I tried using any or all functions but I'm little confused with their use...
1 Kommentar
Azzi Abdelmalek
am 20 Sep. 2012
can you be more clear,
Antworten (1)
Andrew Barton
am 20 Sep. 2012
0 Stimmen
I think all(A==[1 0]) is what you're looking for. A==[1,0] returns a 1x2 array where the first element is true if A(1) == 1, and the second element is true if A(2) == 0. All takes that 1x2 array and only returns true if each of its elements are true.
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!