Matlab App Designer Pop Up Figure

21 ビュー (過去 30 日間)
Kuang-Ting Hsueh
Kuang-Ting Hsueh 2022 年 11 月 17 日
回答済み: Eric Delgado 2022 年 11 月 18 日
Currently I have a GUI edit field named Number of Segments where I can enter a number and a pop up window with tabgroups depending on the value for Number of Segment is inputted. Is there a way to add some sort of callback to the uieditfield of PropogationEdit or LoopsEdit? Also if I have multiple tabs how to differentiate the edit fields for each individual tab? If I can I want to store each tab as an array with the indexes being the edit field then an encompassing array storing each tab's array.
Thank you
Here is the code that I have for reference:
function NumberofsegmentsEditFieldValueChanged(app, event)
value = app.NumberofsegmentsEditField.Value;
app.UIFigure = uifigure("Position",[600 300 400 450]);
TabGroup = uitabgroup(app.UIFigure, "Position",[0 0 400 450]);
nTabs = value;
for i=1:nTabs
tab = uitab(TabGroup,"Title","Segment "+i);
%Propogation
PropogationTxt = uilabel(tab, "Text","Propogation Distance [m]","position",[100 350 150 20]);
PropogationEdit = uieditfield(tab,"numeric","position",[300 350 50 20])
%Loop
LoopTxt = uilabel(tab, "Text","Number of Loops","position",[100 300 150 20]);
LoopsEdit = uieditfield(tab,"numeric","position",[300 300 50 20]);
end
end

回答 (1 件)

Eric Delgado
Eric Delgado 2022 年 11 月 18 日
You can use "Tag" property...
% Tabs creation
UIFigure = uifigure("Position",[600 300 400 450]);
TabGroup = uitabgroup(UIFigure, "Position",[0 0 400 450]);
for i=1:3
tab = uitab(TabGroup,"Title","Segment "+i);
PropogationTxt = uilabel(tab, "Text","Propogation Distance [m]","position",[100 350 150 20]);
PropogationEdit = uieditfield(tab,"numeric","position",[300 350 50 20]);
LoopTxt = uilabel(tab, "Text", "Number of Loops", "position", [100 300 150 20]);
LoopsEdit = uieditfield(tab, "numeric", "position", [300 300 50 20], "Tag", "Segment "+i);
end
% Edit Field search
hObj1 = findall(groot, 'Type', 'uinumericeditfield', 'Tag', 'Segment 1');
hObj2 = findall(groot, 'Type', 'uinumericeditfield', 'Tag', 'Segment 2');
hObj3 = findall(groot, 'Type', 'uinumericeditfield', 'Tag', 'Segment 3');

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by