For loop with string comparison

3 visualizzazioni (ultimi 30 giorni)
HABILA
HABILA il 20 Lug 2020
Commentato: HABILA il 20 Lug 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

Risposta accettata

Bruno Luong
Bruno Luong il 20 Lug 2020
Change to
...
if strcmp(S(i).Status,'Active') || strcmp(S(i).type,'N')
...
end

Più risposte (0)

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by