Failed to "dot indexing" the data from uitable
2 views (last 30 days)
Show older comments
Hi, I am trying to build a GUI with some simple user interactions.
Outside of GUI, I can do "Dot indexing" by referring to its "variablenames". For example, for a table T, I can use "T.Size" to obtain data under the variable name "Size". However, the trick does not work when it involves the GUI.
For "app.UITable", the data is stored under "app.UITable.Data". I tried "app.UITable_OSS1.Data.Size" but it returns an error.
"Dot indexing is not supported for variables of this type."
How could I adjust to make it work? Thanks.
0 Comments
Accepted Answer
Steven Lord
on 10 Nov 2022
The Data property of a uitable can contain different types of data, as stated on this documentation page. If you had stored a table array that contains a variable named Size in that uitable, I would expect that operation to work. But if you'd stored a non-table array in that uitable, it wouldn't.
A = [1 2 3; 4 5 6]
T = array2table(A, 'VariableNames', ["Size", "Weight", "Temperature"])
T.Size % Works
A.Size % Does not work
So either create / populate the uitable using a table array or modify your indexing based on whether the Data property istabular.
More Answers (0)
See Also
Categories
Find more on Tables 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!