Why can't uitable accept strings in 2018b update while uicontrol can accept strings?
古いコメントを表示
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 件のコメント
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
2018 年 9 月 26 日
編集済み: Craig DeAlmeida
2018 年 9 月 26 日
Adam Danz
2018 年 9 月 26 日
Yeah, definitely a bug as Walter pointed out.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!