I am not able to see the rand(3) values in the group tab
2 views (last 30 days)
Show older comments
Kulbir
on 16 Feb 2023
Commented: Walter Roberson
on 16 Feb 2023
I am trying to develop a GUI in app designer 2022, I took Tab group and tried to disply random(3) values in the tab group, but i could not.
i used the following code.
function TabGroupSelectionChanged(app, event)
selectedTab = app.TabGroup.SelectedTab;
selectedTab.UserData= rand(3)
0 Comments
Accepted Answer
Walter Roberson
on 16 Feb 2023
A tab is not itself something that can display data. You would have to have a text or uitable object within the tab that was responsible for the display.
The UserData property of objects is intended to hold whatever data the user wants. There are relatively few cases where Mathworks software uses the UserData field for its own purposes (for example historically in HG1 it was used to hold axes zoom history I seem to recall.) Setting the UserData property of an object will rarely have any effect on what is displayed.
2 Comments
Walter Roberson
on 16 Feb 2023
selectedTab is going to be a uitab object. The available properties of those objects are described at https://www.mathworks.com/help/matlab/ref/matlab.ui.container.tab-properties.html
The UserData property is described at https://www.mathworks.com/help/matlab/ref/matlab.ui.container.tab-properties.html#d124e1784123
User data, specified as any MATLAB array. For example, you can specify a scalar, vector, matrix, cell array, character array, table, or structure. Use this property to store arbitrary data on an object.
If you are working in App Designer, create public or private properties in the app to share data instead of using the UserData property. For more information, see Share Data Within App Designer Apps.
Notice there is no reference there to setting the UserData as triggering any behaviour. A container for arbitrary data of any datatype is not going to trigger display changes -- especially with the documentation saying, "Don't use this anymore".
Tabs have always been just container objects in MATLAB.
More Answers (0)
See Also
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!