Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Hang Vu
Hang Vu el 4 de Mayo de 2019
Comentada: Hang Vu el 4 de Mayo de 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

Respuesta aceptada

per isakson
per isakson el 4 de Mayo de 2019
Editada: per isakson el 4 de Mayo de 2019
Replace
if f == 'NaN'
by
if isnan( f )

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by