Why is it showing Matrix dimensions must agree and how do i fix this?

1 回表示 (過去 30 日間)
It shows this while i try to implement a while loop. I want the loop to keep repeating until user types the correct variable as written earlier.

採用された回答

Walter Roberson
Walter Roberson 2018 年 4 月 14 日
Do not use = or ~= to compare character vectors. Use strcmp() instead.
(With R2016b or later, you can use = and ~= to compare string objects, but you are not using string objects.)
Reminder: we cannot copy and paste a screen snapshot to test with, especially when the screen snapshot cuts off the code.
  3 件のコメント
Walter Roberson
Walter Roberson 2018 年 4 月 14 日
if ~ismember(gh, {'f', 'in', 'fe', 'mi', ...})
disp(...)
...
end
Abhey Pal Singh Kumar
Abhey Pal Singh Kumar 2018 年 4 月 14 日
Thanks so much. All working now

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by