Visualize data in App Designer similarly to Variable Editor
Show older comments
I have an App Designer app which needs to visualize to the user the contents of a struct. The data in the struct are a variety or numeric, string, datetime, etc. I can easily use struct2table and show that data in a UITable, but the fields are used as variable names, i.e. columns: since I have a lot of fields in the struct, this results in a table with one row and many many columns which force the user to scroll left and right to see them all. I cannot "transpose" the table, since I cannot have different data types for a variable in different rows. For now I am working around it by converting all the different data types to string, and then assembling them into a ListBox, which the user can scroll up or down.
The really ideal solution would be to visualize a struct the same way the variable editor does, with all the fields listed as "rows", and their value next to them, in whichever format they natively are.
Is there any way to mimic that behavior using a table? Or using some other UI object?
Thanks!
5 Comments
Adam Danz
on 8 Apr 2021
Why not use a uitable?
Vittorio
on 8 Apr 2021
No, I believe you're describing a variable of class table created by struct2table. You did mention displaying that in a uitable but I'm suggesting you use the uitable differently.
You can make column 1 the field names and column 2 the values - you may need to convert to string or categorical.
Vittorio
on 8 Apr 2021
> I'm not sure what the difference between a variable of class table and the uitable
A table is organized such that the variables are columns and observations are rows.
A uitable is a 2D gridded graphics object that you can organize in just about any way you can imagine.
See my answer below for an example.
Accepted Answer
More Answers (0)
Categories
Find more on Whos 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!