Why can't uitable accept strings in 2018b update while uicontrol can accept strings?
Show older comments
With the release of MATLAB 2018b, a lot of function inputs accept strings as well as char arrays. I'm converting an application with programmatic UI elements and decided to convert these to strings as much as possible as well as using strings is now encouraged by MATLAB. This goes fine for most UI elements, for example:
uicontrol(f, "Position", [0.2 0.2 0.2 0.2], "String", "Hello")
uicontrol(f, "String", "Hello", "Tag", "Test String")
However, using quotes for uitable puts up a variety of errors, for example:
uitable(f, "Tag", "Test Table")
produces both a warning and an error, while
uitable(f, 'Tag', 'Test Table')
is fine. Other series of parameters with quotes produce different errors. And, compared to other UI elements, uitable seems less willing to have strings for its properties. The ColumnName property accepts a string, but ColumnFormat does not.
Is there a particular reason that uitable was mostly left out when it came to the ability to use strings?
3 Comments
You can still use a string to specify a property; but you can't to name the property. For example, this does not produce an error nor a warning in 2018b:
uitable(f, 'Tag', "Test Table")
I can't speculate on the motivation for this, though.
Craig DeAlmeida
on 26 Sep 2018
Edited: Craig DeAlmeida
on 26 Sep 2018
Adam Danz
on 26 Sep 2018
Yeah, definitely a bug as Walter pointed out.
Accepted Answer
More Answers (0)
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!