필터 지우기
필터 지우기

How do you output App data to a calling function?

조회 수: 2 (최근 30일)
Chris Nemecek
Chris Nemecek 2018년 7월 20일
댓글: Chris Nemecek 2018년 7월 31일
I have a function/script that calls an instance of an App I created in AppDesigner. How do I get the App to return data to the function/script upon closing the App?
hApp = selectFiles_v0000; % call to open App within the function/script
importInfo(hApp,trajectoryDirectory,'.nc') % necessary to import function data into the App since I only have Matlab 2016b and do not have the ability to have a StartUpFcn with inputs
uiwait(hApp.selectFiles);
% need to have data from the App available in the function/script at this point

채택된 답변

crixstox
crixstox 2018년 7월 23일
I had a similar probelm and made the following work around.
  1. In the calling function replace 'uiwait(hApp.selectFiles)' with 'uiwait(hApp.UIFigure)'
  2. Generate a button called 'close' in the app and add a callback involving uiresume(app.UIFigure).
  3. Read out the needed data in the calling function (usually with hApp.<name>.Value).
  4. If the app interface is no longer needed call additionally 'hApp.delete'.
I hope this helps.
  댓글 수: 1
Chris Nemecek
Chris Nemecek 2018년 7월 31일
That would seem to work. However, I ended up just using setappdata in the App and getappdata in the calling function.
In the App:
setappdata(0,'var1',var1)
In the calling function:
var1 = getappdata(0,'var1)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by