Wait for job to change state
wait( blocks execution in the client
session until the job identified by the object
j reaches the
'finished' state or fails. The
occurs when all the job’s tasks are finished processing on the workers.
Simulink® models cannot run while a MATLAB® session is blocked by
wait. If you must run
Simulink from the MATLAB client while also running jobs, do not use
If the object is currently or was previously in the specified state, MATLAB does not wait and the function returns immediately. For example, if you run
wait(j,"queued") for a job already in the
"finished" state, the function returns immediately.
Submit a Job To Queue and Wait
Submit a job to the queue, and wait for it to finish running before retrieving its results.
submit(j); wait(j,"running") diary(j)
Submit a Batch Job and Wait
Submit a batch job and wait for it to finish before retrieving its variables.
j = batch('myScript'); wait(j) load(j)
j — Job to wait
Job object whose change in state to wait for, specified as a
state — Job state
Value of the job object’s
State property to wait for, specified
as one of the following:
timeout — Time to wait
Maximum time to wait in seconds, specified as a scalar integer.