I want to pass data between two windows of GUI

16 visualizaciones (últimos 30 días)
Wan Muzamir
Wan Muzamir el 2 de Oct. de 2022
Comentada: Wan Muzamir el 3 de Oct. de 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.

Respuestas (2)

Image Analyst
Image Analyst el 2 de Oct. de 2022

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

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by