Using strfind to find character index in word

2 visualizzazioni (ultimi 30 giorni)
Dylan Warman
Dylan Warman il 16 Set 2019
Risposto: Walter Roberson il 16 Set 2019
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

Risposte (2)

Stephen23
Stephen23 il 16 Set 2019
>> HangWord = 'each';
>> Guess1 = 'e';
>> index = strfind(HangWord, Guess1)
index = 1

Walter Roberson
Walter Roberson il 16 Set 2019
Guess1 = 'e';
HangWord = "each";
index = strfind(HangWord, Guess1);

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by