MATLAB Answers

0

Using strfind to find character index in word

Asked by Dylan Warman on 16 Sep 2019
Latest activity Answered by Walter Roberson
on 16 Sep 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

  0 Comments

Sign in to comment.

Tags

2 Answers

Answer by Stephen Cobeldick on 16 Sep 2019

>> HangWord = 'each';
>> Guess1 = 'e';
>> index = strfind(HangWord, Guess1)
index = 1

  0 Comments

Sign in to comment.


Answer by Walter Roberson
on 16 Sep 2019

Guess1 = 'e';
HangWord = "each";
index = strfind(HangWord, Guess1);

  0 Comments

Sign in to comment.