Is there a command of "not less than or equal to " to vectors?

Hi, want to know if there is a command can compare if two vectors a is not <=b? Now I use while sum(le(a,b))~=N while N is the size of vector. However it is very inconvenient.
Thanks.

 Accepted Answer

all(a<=b)

7 Comments

Thanks, Azzi, it means if all entry of a is <= b and if all is true returns a 1.
Exact, I guess it's what you need.
the comparison is done: the first element of a with the first of b, and so on
Thanks, I wonder if there is a faster way. That is, if we've seen any not<= entry, return 0, otherwise continue.
Maybe
~any(a>b)
But I don't think it will be much faster
No there isn't.
If I recall correctly, someone did submit a MEX routine to do vector comparisons, but unfortunately I cannot seem to locate it at the moment.
Oh, OK, Walter. But theoretically, it can be faster.

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!