How can i share data between two callbacks in app designer

7 ビュー (過去 30 日間)
rsch1983
rsch1983 2018 年 12 月 18 日
編集済み: Cris LaPierre 2018 年 12 月 18 日
Good morning,
I'm trying to use the data I load with
uiopen('*.mat')
in another callbacks but unfortunatealy all my efforts are vanished.
Can you paste some example code please.
Thanks for help

採用された回答

Cris LaPierre
Cris LaPierre 2018 年 12 月 18 日
編集済み: Cris LaPierre 2018 年 12 月 18 日
Yes, but are you using Guide, App Designer, or builiding your gui programmatically?
You have to be mindful of variable scope in guis. Everything occurs in functions, and once the function exits, all variables that were created in it are gone.
The way to make them available in other callback functions is typically to add your variable to a structure. In app designer, it would be to the app structure (app.var1 = [...]). In Guide, it is the handles structure (handles.var1 = [...]).
In Guide you need to update the handles structure if it has been modified.
See this post for more.
  1 件のコメント
Cris LaPierre
Cris LaPierre 2018 年 12 月 18 日
If you are designing your app programmatically, this answer has some helpful details.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by