Passing Data between Apps

117 views (last 30 days)
Eli Blumen
Eli Blumen on 7 Jul 2020
Commented: Adam Danz on 15 Mar 2022
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!

Accepted Answer

Adam Danz
Adam Danz on 7 Jul 2020
Edited: Adam Danz on 15 Mar 2022
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 is 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
end
Step 3: Define callerApp in the Payroll startupFcn
function startupFcn(app, callerApp)
app.callerApp = callerApp;
end
Step 4: Access the callerApp data anywhere within your app.
function updatePayroll(app)
app.callerApp.PayDate
app.callerApp.PayName
end
  25 Comments
Adam Danz
Adam Danz on 15 Mar 2022
> It seems that my secondary app doesn't have access to the public function created in the primary app. Any ideas on how to resolve this?
Is updateplot defined in your primary app or the secondary app?
Sharing the entire error message would also be helpful so I can see the function name(s).

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!