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