フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

if (strcmp(O1,'00000') || strcmp(O1,'10000') || strcmp(O1,'11000')) I used this but still my code is not working?

1 回表示 (過去 30 日間)
Ashok
Ashok 2014 年 3 月 3 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
sir,I used this command which i got from you...if (strcmp(O1,'00000') strcmp(O1,'10000') strcmp(O1,'11000'))...but still my code is not working. I am attaching my code with it. Please check it and tell me the solution.
  1 件のコメント
Image Analyst
Image Analyst 2014 年 3 月 3 日
You did not attach the code. Remember to click both "Choose file" and "Attach file" buttons.

回答 (1 件)

Iain
Iain 2014 年 3 月 3 日
if (strcmp(O1,'00000') || strcmp(O1,'10000') || strcmp(O1,'11000')) ...
Thats easier if you do: if any(strcmp(O1, { '00000','10000','11000' } )
If, and only if, O1 = '00000', without any other characters at all (no commas, no non-printing characters, and no approximations e.g. o instead of O or 0, will the if statement work properly.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by