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.

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 12 Mär. 2013
all(a<=b)

7 Kommentare

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.
Azzi Abdelmalek
Azzi Abdelmalek am 12 Mär. 2013
Bearbeitet: Azzi Abdelmalek am 12 Mär. 2013
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by