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

1 vue (au cours des 30 derniers jours)
Hang Vu
Hang Vu le 4 Mai 2019
Commenté : Hang Vu le 4 Mai 2019
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

Réponse acceptée

per isakson
per isakson le 4 Mai 2019
Modifié(e) : per isakson le 4 Mai 2019
Replace
if f == 'NaN'
by
if isnan( f )
  1 commentaire
Hang Vu
Hang Vu le 4 Mai 2019
Thank you so much! Hope you have a good weekends!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by