| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Parallel Computing Toolbox |
| Contents | Index |
| Learn more about Parallel Computing Toolbox |
cancel(t)
cancel(j)
t | Pending or running task to cancel. |
j | Pending, running, or queued job to cancel. |
cancel(t) stops the task object, t, that is currently in the pending or running state. The task's State property is set to finished, and no output arguments are returned. An error message stating that the task was canceled is placed in the task object's ErrorMessage property, and the worker session running the task is restarted.
cancel(j) stops the job object, j, that is pending, queued, or running. The job's State property is set to finished, and a cancel is executed on all tasks in the job that are not in the finished state. A job object that has been canceled cannot be started again.
If the job is running in a job manager, any worker sessions that are evaluating tasks belonging to the job object will be restarted.
Cancel a task. Note afterward the task's State, ErrorMessage, and OutputArguments properties.
job1 = createJob(jm);
t = createTask(job1, @rand, 1, {3,3});
cancel(t)
get(t)
ID: 1
Function: @rand
NumberOfOutputArguments: 1
InputArguments: {[3] [3]}
OutputArguments: {1x0 cell}
CaptureCommandWindowOutput: 0
CommandWindowOutput: ''
State: 'finished'
ErrorMessage: 'Task cancelled by user'
ErrorIdentifier: 'distcomp:task:Cancelled'
Timeout: Inf
CreateTime: 'Fri Oct 22 11:38:39 EDT 2004'
StartTime: 'Fri Oct 22 11:38:46 EDT 2004'
FinishTime: 'Fri Oct 22 11:38:46 EDT 2004'
Worker: []
Parent: [1x1 distcomp.job]
UserData: []
RunningFcn: []
FinishedFcn: []![]() | batch | clear | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |