| Contents | Index |
If an error occurs during the task evaluation, Error contains the MException object thrown. See the MException reference page for more about the returned information.
Usage | Task object |
Read-only | Always |
Data type | MException object |
The Error property is empty before an attempt to run a task.
When using a job manager, the Error property indicates if a worker has crashed during task execution, but when using a different scheduler Error does not indicate a crash.
The Error's message and identifier contain the same information as the task object properties ErrorMessage and ErrorIdentifier, respectively.
Examine a task's Error property to determine if there was an error during execution:
jm = findResource('scheduler','type','local');
j = createJob(jm);
t = createTask(j, @myfun, 1, argcell);
submit(j)
waitForState(j)
has_error = ~isempty(t.Error)Retrieve the error MException object from a task.
jm = findResource('scheduler','type','local');
j = createJob(jm);
a = [1 2 3 4]; % Note: matrix not square.
t = createTask(j, @inv, 1, {a});
submit(j)
waitForState(j)
e = get(t,'Error')
e =
MException
Properties:
identifier: 'MATLAB:square'
message: 'Matrix must be square.'
cause: {0x1 cell}
stack: [7x1 struct]
ErrorIdentifier, ErrorMessage, Function

See how to solve large problems with minimal effort and reduce simulation time.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |