How do I use if with the value of the array is a string?

1 次查看(过去 30 天)
I want to check if the final value of the string is 'NaN'
parents=[2 3 1 NaN];
f = parents(size(parents,2));
if f == 'NaN'
check=0
else
check=1
end

采纳的回答

per isakson
per isakson 2019-5-4
编辑:per isakson 2019-5-4
Replace
if f == 'NaN'
by
if isnan( f )

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by