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 日

3 投票

if ~a||isnan(a)
Hernia Baby
Hernia Baby 2021 年 3 月 31 日

1 投票

clc, clear
a = NaN;
if a==0 | isnan(a)
%whatever
a
end
a =
NaN

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by