フィルターのクリア

Cannot access callbacks in an object after switching directory?

1 回表示 (過去 30 日間)
Justin
Justin 2012 年 10 月 28 日
I have a class with uicontrols that have callbacks. If I instantiate the class (which opens up a gui), and then switch to another directory within matlab and try to trigger one of the callbacks (i.e. loading an image through a gui callback), I get the error:
Cannot access method 'xxxx' in class 'xxxx'.
This happens even if I switch back to the original directory I was working in. Also, the callbacks work fine as long as long as I dont switch directories. Thanks,
-J

採用された回答

Walter Roberson
Walter Roberson 2012 年 10 月 28 日
I don't know why you would continue to have the problems after you switched back, but the callback routine needs to be on the MATLAB path to be found, so if you are finding it because it is in the current directory and you switch away from that directory you will have problems.
No, MATLAB does not record instantiation paths as it goes along. Having routines resolve differently when you switch directories is considered to be a feature.
  1 件のコメント
Justin
Justin 2012 年 10 月 28 日
The callback routine was a method written within the class definition file; I think switching paths might have messed with this. I ended up just ditching the class approach and converted the file to a simple function call with nested functions (instead of methods). This resolved the problem. Thanks,
-J

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by