How to share variables across Matlab App Designer Apps
조회 수: 30 (최근 30일)
이전 댓글 표시
I have 2 apps, the first app is the main screen from which all functions are performed. The MainScreen app has 1 parameter named " QueryResult" and is coded in the following way.
properties (Access = public)
QueryResult table % Description
end
The MainScreen app also has a button that opens the second app. The second app is the 'advanced search' screen where a user can perform a search and get a table. The table in question is 1x24 and stored in the variable "data". I tried storing the found table into the MainScreen property like so:
data = fetch(conn,query);
MainScreen.QueryResult = data;
If I then access the QueryResult property and print it from the AdvancedSearch app I get the expected result.
display(MainScreen.QueryResult)
_______________________________________________________________________________________________________
subjectid gender birthdate genotype age cage health sessionnumber tasktypesuggested tasktypeactuallydone costvalue certaintycost costprobability certaintyvalue certaintyreward rewardvalue rewardprobability firstday lastday reason rewardintensity cost probabilityreward notes
_________ __________ __________ __________ __________ __________ __________ _____________ _________________ ____________________ __________ _____________ _______________ ______________ _______________ ___________ _________________ __________ __________ __________ _______________ __________ _________________ __________
{'tony'} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char} {0×0 char}
However if I go back into the MainScreen app and try to access the property from within, it is empty and trying to display it results in a 0x0 table. I have no idea what the problem is, and where the fault is occuring. I'd be very appreciative to anyone who could offer answers.
display(app.QueryResult)
______________________________________________________________________________________________________
__________
{0×0 char}
댓글 수: 0
답변 (1개)
Swetha Polemoni
2021년 7월 29일
Hi
A similar question has been discussed on the following MATLAB answers link. You may find this helpful
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!