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

1 次查看(过去 30 天)
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

采纳的回答

Jon
Jon 2013-10-4
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by