フィルターのクリア

nan in if statement

66 ビュー (過去 30 日間)
Lama Hamadeh
Lama Hamadeh 2021 年 3 月 31 日
Hi all,
How can I say:
if (a==0 or a==NaN)
%whatever
end
Thanks.
  1 件のコメント
JKD Power and Energy Solutions
JKD Power and Energy Solutions 2021 年 3 月 31 日
Use the below code:
if (a==0 || isnan(a))
%whatever
end

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

回答 (2 件)

David Hill
David Hill 2021 年 3 月 31 日
if ~a||isnan(a)

Hernia Baby
Hernia Baby 2021 年 3 月 31 日
clc, clear
a = NaN;
if a==0 | isnan(a)
%whatever
a
end
a =
NaN

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by