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

조회 수: 1 (최근 30일)
Hang Vu
Hang Vu 2019년 5월 4일
댓글: Hang Vu 2019년 5월 4일
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