フィルターのクリア

Continuous slider callback, not updated handles in callback function.

6 ビュー (過去 30 日間)
Joakim Magnusson
Joakim Magnusson 2016 年 6 月 29 日
コメント済み: Joakim Magnusson 2016 年 6 月 30 日
I am writing a program with several gui's/windows using tabs. Therefore are all handles accessible from tha main gui/window. My addlistener is placed in a gui's (not the main gui) openingFcn where i have handles from the main gui as input argument. After addlistener is used i am adding more variables in my handles and these variables are not in handles in my continuous callback function. Why is that and is there an easy solution? Or should i try and use addlistener later in the program (can't think of a clean way to do this) when all variables have been added to handles.

採用された回答

Adam
Adam 2016 年 6 月 29 日
Passing handles around is not a good idea because it is passed by value, so as you have seen, anything added after does not come through.
You can pass the hObject of the GUI around instead and then use
handles = guidata( hObject );
I would never recommend having GUIs have such access to each other in general, but the alternative I use is too in-depth to explain if you are not familiar with Matlab OOP. I pass class objects between UIs instead and attach listeners to those. I never want a GUI listening to another GUI, I would much rather have one GUI update the properties of a shared object and another GUI listen to that shared object. It is far more robust and less prone to bugs also. But if you have never done Matlab OOP it takes more explaining than I have time for right now.
  1 件のコメント
Joakim Magnusson
Joakim Magnusson 2016 年 6 月 30 日
I was new with matlab when i began writing this code and now i think it's to big to change it. But thanks for the input! Had forgotten about guidata, that made the trick.

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by