Borrar filtros
Borrar filtros

Cannot access callbacks in an object after switching directory?

1 visualización (últimos 30 días)
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Oct. de 2012
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 comentario
Justin
Justin el 28 de Oct. de 2012
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by