For loop with string comparison

2 visualizaciones (últimos 30 días)
HABILA
HABILA el 20 de Jul. de 2020
Comentada: HABILA el 20 de Jul. de 2020
I am getting error with this code. Can someone help me with this ?
for i=1:100
if (S(i).Status=='Active' || S(i).type=='N')
disp(i)
else
continue;
end
end

Respuesta aceptada

Bruno Luong
Bruno Luong el 20 de Jul. de 2020
Change to
...
if strcmp(S(i).Status,'Active') || strcmp(S(i).type,'N')
...
end
  1 comentario
HABILA
HABILA el 20 de Jul. de 2020
This one worked, Thank U so much.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings 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