How to use app2 to control the buttons of app1 in app designer?

조회 수: 1 (최근 30일)
jie ren
jie ren 2020년 12월 26일
답변: Mario Malic 2020년 12월 26일
The two apps are linked, and then I wrote a lot of things in the buttons in app1. App2 wants to directly control and press the buttons of app1, and then read the global variables. I don't know if there is any implementation method. Thank you

답변 (1개)

Mario Malic
Mario Malic 2020년 12월 26일
  • Do you run your apps in the same instance of MATLAB?
If yes, set tags, or unique names for your apps in Component Browser, under UIFigure - Identifiers, and get their handles this way:
%% in your script
app1 = get(findall(0, 'Tag', 'AppUIFigure1'), 'RunningAppInstance');
app2 = get(findall(0, 'Tag', 'AppUIFigure2'), 'RunningAppInstance');
This way, you have access to both apps.
If no, I wouldn't know how to find the other running MATLAB instance.
  • What about simplifying your problem into having a single app with two windows?
Note: don't use global variables, it's unnecessary.

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by