Is there a way to update input arguments from main app to dialogue app if the dialogue app is running in single instance?

1 次查看(过去 30 天)
staurtupFcn is no more processed after first access to dialogue app and arguments are not updated according to following access from main app.

回答(1 个)

Eric Delgado
Eric Delgado 2022-11-22
Yes. Just create a PUBLIC property or a public function in your dialogue app and call it everytime you change something in your main app. You can use try catch block or a handle validation.
% In your dialogue app - "dialogApp.mlx"
properties (Access = public)
myProperty
end
methods (Access = public)
function myPublicFunction(app, newValue)
app.myProperty = newValue;
end
end
% In your main app
properties (Access = private)
hWin = [] % handle to your dialogue window
end
% Callback for a pushed button, opening your dialogue window, for example
app.hWin = dialogApp(app);
% Changing a value in your dialogue windows from your main app
if ~isempty(app.hWin)
app.hWin.myPublicFunction(10);
end
% Or...
try
app.hWin.myPublicFunction(10);
catch
end
% Or...
try
app.hWin.myProperty = 10;
catch
end

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by