I am not able to see the rand(3) values in the group tab
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2023-2-16
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 个评论
Walter Roberson
2023-2-16
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!