Borrar filtros
Borrar filtros

Trying to make a Hiragana guesser

3 visualizaciones (últimos 30 días)
Raul
Raul el 11 de Feb. de 2024
Comentada: VBBV el 11 de Feb. de 2024
Hi, for one of my classes I've been trying to make a hiragana guesser, but when I run it nothing shows on the command window. I'm new to matlab so maybe I just made a mistake, but as far as I check I see nothing wrong. Does it have something to do with the symbols? When I run it here the symbol does appear, but the input does not work.
a=("あ");
i=("い");
u=("う");
e=("え");
o=("お");
rand=randi(5);
switch rand
case 1
disp(a)
hg=input("Insert Kana \n");
if hg==a
fprintf("Correct")
else
fprintf("Incorrect")
end
case 2
disp(i)
hg=input("Insert Kana \n");
if hg==i
fprintf("Correct")
else
fprintf("Incorrect")
end
case 3
disp(u)
hg=input("Insert Kana \n");
if hg==u
fprintf("Correct")
else
fprintf("Incorrect")
end
case 4
disp(e)
hg=input("Insert Kana \n");
if hg==e
fprintf("Correct")
else
fprintf("Incorrect")
end
case 5
disp(o)
hg=input("Insert Kana \n");
if hg==o
fprintf("Correct")
else
fprintf("Incorrect")
end
end
Unable to run the 'fevalJSON' function because it calls the 'input' function, which is not supported for this product offering.
  1 comentario
VBBV
VBBV el 11 de Feb. de 2024
a=("あ");
i=("い");
u=("う");
e=("え");
o=("お");
rand=randi(5)
rand = 2
switch string(rand)
case '1'
disp(a)
hg="a"%input("Insert Kana \n");
if strcmp(hg,a)
fprintf("Correct")
else
fprintf("Incorrect")
end
case '2'
disp(i)
hg= "い"%input("Insert Kana \n");
if strcmp(hg,i)
fprintf("Correct")
else
fprintf("Incorrect")
end
case '3'
disp(u)
hg="あ"%input("Insert Kana \n");
if strcmp(hg,u)
fprintf("Correct")
else
fprintf("Incorrect")
end
case '4'
disp(e)
hg="y"%input("Insert Kana \n");
if strcmp(hg,e)
fprintf("Correct")
else
fprintf("Incorrect")
end
case '5'
disp(o)
hg="t"%input("Insert Kana \n");
if strcmp(hg,o)
fprintf("Correct")
else
fprintf("Incorrect")
end
end
hg = "い"
Correct
The input function cannot work in online editor, but certainly it does when its run in a PC installed with MATLAB

Iniciar sesión para comentar.

Respuesta aceptada

VBBV
VBBV el 11 de Feb. de 2024
rand=randi(5)
rand = 2
switch string(rand)
case '1'
disp('something')
case '2'
disp('something')
end
something
  4 comentarios
Raul
Raul el 11 de Feb. de 2024
Thank you it worked and now I can expand it to the rest of the hiragana alphabet.
VBBV
VBBV el 11 de Feb. de 2024
Yes. It's shown in my comment to your question. If it worked for you please accept the answer. Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Functions en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by