Run code with two sections - app designer
2 ビュー (過去 30 日間)
古いコメントを表示
I made an example of a problem I have.
I wrote a code with 2 sections
When I press RUN_1 it calculates X * Y (this is works)
When I press RUN_2 he does not remember the value XY so he does not compute me XYZ (this is not works :( )
Thanks!
採用された回答
Cris LaPierre
2021 年 7 月 13 日
編集済み: Cris LaPierre
2021 年 7 月 14 日
You need to keep in mind variable scope. All your callbacks are functions. Variables created inside a function are lost once the function terminates. The way around this in app designer is to create an app property to capture these values. You can then access them using the app.varName syntax.
3 件のコメント
Cris LaPierre
2021 年 7 月 15 日
You are not creating a function. You are creating a propery. There is no need to change the name. Use XY. The only change is, instead of using XY, you would now use app.XY.
You can see an example here: https://www.mathworks.com/help/matlab/creating_guis/share-data-across-callbacks-in-app-designer.html
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!