For loop with string comparison

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

 Accepted Answer

Change to
...
if strcmp(S(i).Status,'Active') || strcmp(S(i).type,'N')
...
end

More Answers (0)

Categories

Asked:

on 20 Jul 2020

Commented:

on 20 Jul 2020

Community Treasure Hunt

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

Start Hunting!