フィルターのクリア

Help with "matrix dimensions must agree".

1 回表示 (過去 30 日間)
Kyle Reagan
Kyle Reagan 2016 年 12 月 4 日
コメント済み: Star Strider 2016 年 12 月 4 日
In my code I have an input that says answer = input('Please type "yes" or no".','s'); if answer == 'yes' blah blah else disp('Error, please make sure a file is uploaded.') end
For some reason when I enter "no", there is a problem where it says "Error. Matrix dimensions don't agree." But when i enter "n" it gives me my custom error statement for the else condition.
  1 件のコメント
Kyle Reagan
Kyle Reagan 2016 年 12 月 4 日
if true
% answer = input('Has a file been uploaded? Answer "yes" or "no" in the command window. \n','s');
if answer == 'yes'
figure
histogram(file)
else
disp('Error. Something went wrong. Please exit program and try again. \n')
end
end

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2016 年 12 月 4 日
Change the if condition to:
if strcmp(answer, 'yes')
  2 件のコメント
Kyle Reagan
Kyle Reagan 2016 年 12 月 4 日
Thanks, works like a charm!
Star Strider
Star Strider 2016 年 12 月 4 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by