Other things I tried and it still doesn't work:
answer = {""}; % get around MatLab 2023b bug?
answer = inputdlg("Enter ...
So, in real program str is set to a Value of a text edit field (in case that matters)
str = app.Name.Value;
So I changing str in case it's actually an input error, not output error:
str = char(app.Name.Value);
Same error every time.
Inspite of claims to the contrary, it turns out it does matter if you do
str = "JUNK"
vs
str = 'JUNK'
>> str = 'JUNK'
str =
'JUNK'
>> class(str)
ans =
'char'
>> str = "JUNK"
str =
"JUNK"
>> class(str)
ans =
'string'
Fixed it with
str = string(app.Name.Value);
Suggestions to MatLab developers:
- If you are going to be so picky about types then say so don't pretend it doesn't matter. (' ' vs " ")
- If you are going to throw an error then identify it correctly so we don't waste our time on red herrings: Input error not output error
Another example where MatLab is sloppy and strict at the same time:
K>> sel = uiconfirm(app.MouseOdor,"Change the Output Folder?", ...
"Save Data Folder",Options=['YES','NO'], ...
Icon="question",DefaultOption=2);
Error using uiconfirm
'DefaultOption' must be a character vector or a string scalar from the 'Options'
cell array or an index of the 'Options' cell array
K>> sel = uiconfirm(app.MouseOdor,"Change the Output Folder?", ...
"Save Data Folder",Options=["YES","NO"], ...
Icon="question",DefaultOption=2);
K>> sel
sel =
'NO'
SO answer is ' ' type but my Options list have to be " "? Is this a new thing that was doumented somewhere?