필터 지우기
필터 지우기

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