« Earlier2 items total Later »

Debug Java Objects In Matlab

For Matlab R14+ you can start Matlab as


Alternatively again you can start matlab with some command line flags.

matlab -jdb


And then you can connect to Matlab over port 4444 with any JPDA-supporting debugger (NetBeans, Sun Studio, Eclipse, etc.).

For lower versions of Matlab the following advice may help. First read the below information on the java.opts file.


http://www.mathworks.com/support/solutions/data/28748.shtml



Then add the following parameters to the java.opts file

-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n


or, alternatively, if you are on Windows system, you could use

-Xdebug
-Xrunjdwp:transport=dt_shmem,address=matlab,server=y,suspend=n


ATTENTION!!! Each option must be on a separate line in the java.opts file, otherwise Java will not initialize properly.

Set breakpoint on the last encountered error.

Often you just want matlab to stop on the last error encountered. It is a pain having to type it in manually all the time so now just type at the command line

dbstop_lasterr


using the implementation.

function dbstop_lasterr
    err = lasterror;
    if ~isempty(err)
        eval(sprintf('dbstop if caught error %s', err.identifier));
    end
end

« Earlier2 items total Later »




Sponsored by

Sole Central

Your one stop shop for Birkenstock and Crocs shoes and sandles.