Passing Data between Apps

128 ビュー (過去 30 日間)
Eli Blumen
Eli Blumen 2020 年 7 月 7 日
コメント済み: Adam Danz 2022 年 3 月 15 日
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!

採用された回答

Adam Danz
Adam Danz 2020 年 7 月 7 日
編集済み: Adam Danz 2022 年 3 月 15 日
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 件のコメント
Patrick Mirek
Patrick Mirek 2022 年 3 月 15 日
Hi Adam,
I followed the documentation exactly, but I'm getting an error which says "undefined function '_' for input arguments of type 'double'.", and it occurs when I call the function from the dialog box (in the example given in the documentation, it's the line: updateplot(app.CallingApp,app.EditField.Value,app.DropDown.Value);).
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?
Adam Danz
Adam Danz 2022 年 3 月 15 日
> 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).

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSystem Commands についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by