- You could pass the variables directly (depending on how your GUI is written)
- Please DON'T use global variables to share the content
- Use "setappdata" instead
- Or write your data to a temporary *.mat file that you load in the second GUI
- It might be possible to nest the second GUI within the first one, although I'm not 100% sure if this will work.
- if all else fails use "assignin" and send the vars to base workspace
How do I get a Matlab UI (app) to call another UI so that it appears that my app has multiple pages?
12 次查看(过去 30 天)
显示 更早的评论
I am looking for a code example that will show me how to call another UI. I can not find any decent examples of this online. I have been trying to get a push button to call this other UI.
classdef App1 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
Button matlab.ui.control.Button
end
methods (Access = private)
% Button pushed function: Button
function ButtonPushed(app, event)
% (WHAT GOES HERE TO CALL OTHER UI?) <----------------
end
end
% App initialization and construction
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure
app.UIFigure = uifigure;
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'UI Figure';
setAutoResize(app, app.UIFigure, true)
%
% Create Button
app.Button = uibutton(app.UIFigure, 'push');
app.Button.ButtonPushedFcn = createCallbackFcn(app, @ButtonPushed, true);
app.Button.Position = [271 264 100 22];
end
end
end
Thank you to anyone who helps!
0 个评论
采纳的回答
dbmn
2016-11-30
There are two possibilities:
a) create a new "Tab" in your existing GUI with uitab
b) just call the other Gui in the button press function like you would call any script or function.
c) About passing data or variables.
更多回答(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!