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

 採用された回答

Bruno Luong
Bruno Luong 2020 年 7 月 20 日

0 投票

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

1 件のコメント

HABILA
HABILA 2020 年 7 月 20 日
This one worked, Thank U so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

タグ

質問済み:

2020 年 7 月 20 日

コメント済み:

2020 年 7 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by