필터 지우기
필터 지우기

if statement for string

조회 수: 2 (최근 30일)
Max
Max 2015년 11월 10일
답변: Guillaume 2015년 11월 10일
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일
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개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by