Error using input,,, Undefined function or variable 'friend'.

1 visualización (últimos 30 días)
Jon
Jon el 4 de Oct. de 2013
Respondida: Jon el 4 de Oct. de 2013
I've just started using Matlab, I previously got this to work, but for some reason I can't figure out why it's not working any more. Anyway, it's just a mess around.
question = input('say friend and enter');
str = 'correct';
message = [str];
if (quesition ~= friend);
disp(message)
end

Respuesta aceptada

Jon
Jon el 4 de Oct. de 2013
It's fine now, I didn't account for the fact that I used letters instead of numbers, so:
question = input('say friend and enter ', 's'); str = 'correct'; message = [str]; if (quesition ~= 'friend'); disp(message) end

Más respuestas (0)

Categorías

Más información sobre Numeric Types 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