MATLAB: How to restore breakpoints in MATLAB files that were defined inside a package directory with MATLAB 7.6 (R2008a)

breakMATLABpoint

I am trying to restore breakpoints that were saved to a structure using DBSTATUS like so:
s = dbstatus;
However, when a breakpoint was set in an ordinary MATLAB file that was created inside a package directory (i.e. +mypack), the breakpoint is not restored and I do not receive an error message when I execute the following line:
dbstop(s);
The same issue occurs with MATLAB files in the package directory that contains a class definition. However, in addition to breakpoints not being restored, I also get the following error message: ERROR: ??? Error using ==> dbstop Cannot find function "myclass".
where "./+mypack/myclass.m" contains the class definition.
Another similar situation occurs when class methods are stored in @-directories. When trying to restore a breakpoint in a file ./@myClass/myMethod.m, the breakpoint is not restored and I get the following error message: ERROR: ??? Error using ==> dbstop Cannot find function "myClass.myMethod".

Best Answer

In order to restore the breakpoints that were set in MATLAB files that were organized into a package or methods in @-directories, the DBSTATUS structure must be created with the '-completenames' switch like so:
dbstatus('-completenames');
This results in the "name" field of the resulting structure to contain the full path information as well.
Note that in MATLAB R2015b and later releases, this error does no longer occur.