| Contents | Index |
FinishedFcn specifies the function file to execute when a job or task completes its execution.
The callback executes in the local MATLAB session, that is, the session that sets the property, the MATLAB client.
Notes The FinishedFcn property is available only when using the MathWorks job manager as your scheduler. The FinishedFcn property applies only in the client MATLAB session in which it is set. Later sessions that access the same job or task object do not inherit the setting from previous sessions. |
Usage | Task object or job object |
Read-only | Never |
Data type | Function handle |
FinishedFcn can be set to any valid MATLAB callback value.
The callback follows the same model as callbacks for Handle Graphics®, passing to the callback function the object (job or task) that makes the call and an empty argument of event data.
Create a job and set its FinishedFcn property using a function handle to an anonymous function that sends information to the display.
jm = findResource('scheduler','type','jobmanager', ...
'name','MyJobManager','LookupURL','JobMgrHost');
j = createJob(jm, 'Name', 'Job_52a');
set(j, 'FinishedFcn', ...
@(job,eventdata) disp([job.Name ' ' job.State]));
Create a task whose FinishFcn is a function handle to a separate function.
createTask(j, @rand, 1, {2,4}, ...
'FinishedFcn', @clientTaskCompleted);
Create the function clientTaskCompleted.m on the path of the MATLAB client.
function clientTaskCompleted(task,eventdata) disp(['Finished task: ' num2str(task.ID)])
Run the job and note the output messages from the job and task FinishedFcn callbacks.
submit(j) Finished task: 1 Job_52a finished

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 |