MATLAB: How to retrieve error message when running script on cluster

cluster error remote

Hi,
I am running batch jobs using MATLAB remotely on a cluster. How to view the eventual error messages(where I hope to find the line of code where the problem is)? Thanks in advance.

Best Answer

The task within the job object returned by the batch command has a property called Error which has the error stack. You could do something like this:
job = batch('assert(false)');
wait(job);
getReport(job.Tasks(1).Error)
Also note that if you simply call load on the job you'll see the error.