How to share variables across Matlab App Designer Apps
16 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Swetha Polemoni
on 29 Jul 2021
Hi
A similar question has been discussed on the following MATLAB answers link. You may find this helpful
0 Comments
See Also
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!