How to share variables across Matlab App Designer Apps

35 visualizaciones (últimos 30 días)
Luis Davila
Luis Davila el 26 de Jul. de 2021
Respondida: Swetha Polemoni el 29 de Jul. de 2021
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}

Respuestas (1)

Swetha Polemoni
Swetha Polemoni el 29 de Jul. de 2021
Hi
A similar question has been discussed on the following MATLAB answers link. You may find this helpful

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by