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.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 12일
all(a<=b)

댓글 수: 7

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 2013년 3월 12일
편집: Azzi Abdelmalek 2013년 3월 12일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by