Using strfind to find character index in word

조회 수: 2 (최근 30일)
Dylan Warman
Dylan Warman 2019년 9월 16일
답변: Walter Roberson 2019년 9월 16일
hi, i have a script where i must find the index of the letter e in the word each
Guess1 = e;
HangWord = "each"
index = strfind(HangWord, 'Guess1')
this returns index=[]
thank you

답변 (2개)

Stephen23
Stephen23 2019년 9월 16일
>> HangWord = 'each';
>> Guess1 = 'e';
>> index = strfind(HangWord, Guess1)
index = 1

Walter Roberson
Walter Roberson 2019년 9월 16일
Guess1 = 'e';
HangWord = "each";
index = strfind(HangWord, Guess1);

카테고리

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