MATLAB Answers

Passing Data between Apps

33 views (last 30 days)
Eli Blumen
Eli Blumen on 7 Jul 2020
Edited: Adam Danz on 1 Aug 2020 at 18:44
I'm making an app that calls up additional apps for input.
I've managed to do this successfully when all the variables are created in the second app.
However, I now need to make an app that has a drop down input that draws its items from the main app.
The guide on multi window apps is very good on showing how to "pass down" data, but not on "passing up" data.
I really need some help on this!


Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 7 Jul 2020
Edited: Adam Danz on 11 Jul 2020 at 18:03
The documentation you mentioned, Creating Multiwindow Apps in App Designer, shows how to pass data both ways. If there's a section that is unclear, I'd be glad to help out with that step.
The main idea it to get access to the app handle for both apps. This answer also reviews some strategies.
Update: Here's a general idea of how to access external app data within a second app.
Step 1: Set up the Payroll app to receive one additional input which will be the app handle to the app that calls Payroll.
function startupFcn(app, callerApp)
Step 2: Within the Payroll app, delcare the callerApp as a private property.
It will look something like this
properties (access = private)
callerApp % handle to caller app
Step 3: Define callerApp in the Payroll startupFcn
function startupFcn(app, callerApp)
app.callerApp = callerApp;
Step 4: Access the callerApp data anywhere within your app.
function updatePayroll(app)


Adam Danz
Adam Danz on 19 Jul 2020 at 23:27
Are you getting any error message? I don't have enough clues here to figure out what's going on. For example, is customer company name an independent variable and in which app? Why does it look like an independant variable in one line but an app property in another line?
Eli Blumen
Eli Blumen on 1 Aug 2020 at 16:56
The customer company name is an independent variable in the main app.
Adam Danz
Adam Danz on 1 Aug 2020 at 18:43
This line shows that it's a property in your app
app.CustomerDropDown.Items = app.callerApp.CustomerCompanyName;
but this line shows that's an independent variable
CustomerCompanyName = {'Village Toy Shop'; . . . ;'Odds n Ends'};
so there's an inconsistency unless the line above is defined within the properties section.
If that line is not defined within the properties section, you may need to define it this way.
app.callerApp.CustomerCompanyName = {'Village Toy Shop'; . . . ;'Odds n Ends'};

Sign in to comment.

More Answers (0)