I want to pass data between two windows of GUI

16 Ansichten (letzte 30 Tage)
Wan Muzamir
Wan Muzamir am 2 Okt. 2022
Kommentiert: Wan Muzamir am 3 Okt. 2022
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.

Antworten (2)

Image Analyst
Image Analyst am 2 Okt. 2022

Walter Roberson
Walter Roberson am 2 Okt. 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
  1 Kommentar
Wan Muzamir
Wan Muzamir am 3 Okt. 2022
Which callbacks I need to use for the dialog app, is it startup or I just need to create public function?
Thank you

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by