I am not able to see the rand(3) values in the group tab

2 Ansichten (letzte 30 Tage)
Kulbir
Kulbir am 16 Feb. 2023
Kommentiert: Walter Roberson am 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)

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 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 Kommentare
Kulbir
Kulbir am 16 Feb. 2023
The same code i used in 2016(b), and it's working.
Walter Roberson
Walter Roberson am 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
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by