User`s guide
11 Functions — Alphabetical List
11-10
is the cwd of MATLAB when the batch command is executed. If the string for this
argument is '.', there is no change in folder before batch execution.
• 'CaptureDiary' — A logical flag to indicate that the toolbox should collect the diary
from the function call. See the diary function for information about the collected
data. The default is true.
• 'Pool' — An integer specifying the number of workers to make into a parallel
pool for the job in addition to the worker running the batch job itself. The script or
function uses this pool for execution of statements such as parfor and spmd that are
inside the batch code. Because the pool requires N workers in addition to the worker
running the batch, there must be at least N+1 workers available on the cluster. You
do not need a parallel pool already running to execute batch; and the new pool that
batch creates is not related to a pool you might already have open. (See “Run a Batch
Parallel Loop”.) The default value is 0, which causes the script or function to run on
only a single worker without a parallel pool.
Examples
Run a batch script on a worker, without using a parallel pool:
j = batch('script1');
Run a batch script that requires two additional files for execution:
j = batch('myScript','AttachedFiles',{'mscr1.m','mscr2.m'});
wait(j);
load(j);
Run a batch pool job on a remote cluster, using eight workers for the parallel pool in
addition to the worker running the batch script. Capture the diary, and load the results
of the job into the workspace. This job requires a total of nine workers:
j = batch('script1','Pool',8,'CaptureDiary',true);
wait(j); % Wait for the job to finish
diary(j) % Display the diary
load(j) % Load job workspace data into client workspace
Run a batch pool job on a local worker, which employs two other local workers for the
pool. Note, this requires a total of three workers in addition to the client, all on the local
machine:
j = batch('script1','Profile','local','Pool',2);