How to share variables across Matlab App Designer Apps
17 次查看(过去 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!