Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

1 次查看(过去 30 天)
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 个)

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