x=6 y=7 disp(x&&y)
why is the answer 1

1 件のコメント

Walter Roberson
Walter Roberson 2021 年 2 月 25 日
https://www.mathworks.com/help/matlab/ref/logicaloperatorsshortcircuit.html

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

 採用された回答

David Hill
David Hill 2021 年 2 月 25 日

0 投票

You can run the code and find out the answer. This is all about logical operations.
logical(6)&&logical(7);% by using && it converts 6 and 7 into their logical equivalent and AND them together
logical(-1);%logical of anything other than zero is 1

その他の回答 (0 件)

カテゴリ

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

タグ

質問済み:

2021 年 2 月 25 日

編集済み:

2021 年 2 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by