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)
Josh Shamir
Josh Shamir 2016 年 11 月 22 日
Thank you Alexandra Harkai and Guillaume for the valuable help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by