Say I have something like
word='example'
and letter='e'
I'm trying write a if state for example
if word contains letter
.......
elseif word doesn't have letter
....
end

 채택된 답변

Guillaume
Guillaume 2015년 11월 10일

0 개 추천

if ismember(letter, word)
%do something
else
%do something else
end
Note the use of else and not elseif. There is no need to test for the false condition.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

질문:

Max
2015년 11월 10일

답변:

2015년 11월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by