I want to pass data between two windows of GUI
16 views (last 30 days)
Show older comments
I want to pass data from the first window to the secod window. I am not sure how to do it since I am new to this app designer.
I already try few steps from the youtube, but the second window did not progress the output that I want.
Mainapp code:
properties (Access = private)
DialogApp % Description
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: CALCULATEButton
function CALCULATEButtonPushed(app, event)
app.DialogApp = dialogapp(app);
delete(app)
end
% Value changed function: FORCEFNEditField
function FORCEFNEditFieldValueChanged(app, event)
value = app.FORCEFNEditField.Value;
end
Dialogapp code:
properties (Access = private)
CallingApp % Description
end
methods (Access = public)
function importdata(app)
app.FORCEFNEditField=force;
app.AREAAm2EditField=area;
stress = force/area;
app.STRESSFANm2EditField.Value= stress;
end
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app, mainapp)
app.CallingApp = mainapp;
end
end
I not sure which part I was wrong. Hope u guys can help me.
0 Comments
Answers (2)
Walter Roberson
on 2 Oct 2022
Something closer to
Mainapp:
properties (Access = public)
force
area
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: CALCULATEButton
function CALCULATEButtonPushed(app, event)
dialogapp(app);
delete(app)
end
% Value changed function: FORCEFNEditField
function FORCEFNEditFieldValueChanged(app, event)
app.force = app.FORCEFNEditField.Value;
end
function AREAAM2EditFieldValueChanged(app, event)
app.area = app.AREAAM2EditField.Value;
end
Dialogapp:
methods (Access = public)
% Code that executes after component creation
function dialogapp(mainapp)
app.stressFANM2TextField.Value = mainapp.force / mainapp.area;
end
end
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!