Dear All,
I would like to know the reasons why this happens:
>> 3 && -4
ans =
1
Thanks in advance for your kindly support.
Best Regards,
Josh

 채택된 답변

Alexandra Harkai
Alexandra Harkai 2016년 11월 22일
편집: Alexandra Harkai 2016년 11월 22일

1 개 추천

>> logical(3)
ans =
1
>> logical(-4)
ans =
1
So 1 && 1 = 1, according to the numeric-to-logical documentation.

댓글 수: 2

Guillaume
Guillaume 2016년 11월 22일
To add to this, only 0 is considered false by matlab (and many many other languages)
Thank you Alexandra Harkai and Guillaume for the valuable help.

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

추가 답변 (0개)

카테고리

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

질문:

2016년 11월 22일

댓글:

2016년 11월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by