Why is it showing Matrix dimensions must agree and how do i fix this?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Abhey Pal Singh Kumar
am 14 Apr. 2018
Kommentiert: Abhey Pal Singh Kumar
am 14 Apr. 2018
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.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 14 Apr. 2018
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 Kommentare
Walter Roberson
am 14 Apr. 2018
if ~ismember(gh, {'f', 'in', 'fe', 'mi', ...})
disp(...)
...
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!