How to share data between two apps which is made from app designer?

41 ビュー (過去 30 日間)
Junghak
Junghak 2016 年 3 月 16 日
回答済み: Chris Portal 2016 年 4 月 10 日
When I use guide in matlab, I used to use setappdata and getappdata function to share data between different gui. At this time I made two app using app designer, how to share data between two apps?

回答 (2 件)

Dave Behera
Dave Behera 2016 年 3 月 24 日
  1 件のコメント
Junghak
Junghak 2016 年 3 月 25 日
|Thanks for your answer.
I followed example and it's ok. but one thing whenenver I push the the button in first app the second app opens again. I want to make the second app open at first call. After first call, from second call how to code make the second app not to re open and just send data only?

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


Chris Portal
Chris Portal 2016 年 4 月 10 日
One way of doing this would be:
  1. Create a private property in App1 called SharedData. Initialize it to a default value that you can reliably check later to determine if App2 has set it yet or not.
  2. Create a public function in App1 called setSharedData(app, newdata) which does any necessary checking before setting app.SharedData to newdata
  3. When App1 needs to call App2, check whether app.SharedData is set to the default value from step #1. If it is, tell App2 to open. Otherwise, tell App2 to just send data.

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by