Ältere Kommentare anzeigen
clear
clc
word=lower(double(input('Enter a character \n')));
letter = char(input('Guess a character : ','s'));
stat = findstr(word,letter);
I'm trying to get the user to enter any number of character(not case sensitive). Then enter any random character and see if it matches any character of their first input.
2 Kommentare
Chandra Kurniawan
am 7 Dez. 2011
What are you trying todo??
You said that 'trying to get the user to enter any number'.
But your code :
word=lower(double(input('Enter a character \n')));
Now, how can I use command 'lower' with numerical (double) input??
command lower works only for string, right??
Chris
am 7 Dez. 2011
I thought lower was to not make it not case sensitive. And I'm trying to get the user to any character, not just numbers.
Akzeptierte Antwort
Weitere Antworten (1)
Sven Schoeberichts
am 7 Dez. 2011
word = input('Enter a word: ', 's');
letter = input('Guess a character : ','s');
stat = ismember(letter,lower(word));
stat = 1: character is present in word
stat = 0: character is not present in word
1 Kommentar
Dylan
am 7 Dez. 2011
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!