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

1 view (last 30 days)
staurtupFcn is no more processed after first access to dialogue app and arguments are not updated according to following access from main app.

Answers (1)

Eric Delgado
Eric Delgado on 22 Nov 2022
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

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!