필터 지우기
필터 지우기

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 CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by