Cannot use "v>=0"?

1 回表示 (過去 30 日間)
Caedon Berkenmeier
Caedon Berkenmeier 2021 年 9 月 16 日
コメント済み: Caedon Berkenmeier 2021 年 9 月 16 日
Hello. I am trying to scan and obtain numbers in a list until an even and negative number is read. The number has to be even and negative. I am trying to use this while loop: while rem(v,2)~=0||v>=0. If I remove the "=" sign, it does the job for the most part, however "0" is not a negative number. That is why I am trying to use >=0. I keep getting the error "Operands to the logical and (&&) and or (||) operators must be convertible to logical scalar values." Is there another solution to determine if a number is not negative?

採用された回答

KSSV
KSSV 2021 年 9 月 16 日
while rem(v,2)~=0 | v>=0
  1 件のコメント
Caedon Berkenmeier
Caedon Berkenmeier 2021 年 9 月 16 日
Thank!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by