0
这里的时候是我的代码:尺寸不匹配的错误比较字符串“==”
a='abc';
key = input('Enter secret: ', 's');
if key =='abc'
fprintf('Correct')
else
fprintf('Wrong. Re-enter.');
end
当我运行代码,我进入abcdefg
,它显示了一个错误:
Error using ==, matrix dimension must be agree.
怎么办我防止这样的错误?
使用[strcmp](https://de.mathworks.com/help/matlab/ref/strcmp.html)来比较字符串。 –
谢谢先生。我忘了这个功能! – kenreal