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.

回答(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 CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by