I am not able to see the rand(3) values in the group tab
조회 수: 2 (최근 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!