3>2>1 returns logical 0?
이전 댓글 표시
When I run 3>2>1 it returns logical 0 (false). Sorry if its a basic question but I can't understand how this is not true.
채택된 답변
추가 답변 (2개)
Guillaume
2015년 11월 30일
You cannot chain comparisons. You have to use logical operators.
3>2>1
is the same as
(3>2) > 1
which evaluates to
true > 1
which is false since true is the same as 1.
To do what you want:
3>2 && 2>1
I think the compiler probably solves this:
(3>2)>1
ans =
0
i.e 1>1= 0
카테고리
도움말 센터 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!