Main Content

batch

Run MATLAB script or function on worker

Syntax

Description

j = batch(script) runs the script file script on a worker in the cluster specified by the default cluster profile. (Note: Do not include the .m file extension with the script name.) The function returns j, a handle to the job object that runs the script. The script file script is copied to the worker.

By default, workspace variables are copied from the client to workers when you run batch(script). Job and task objects are not copied to workers.

example

j = batch(expression) runs expression as an expression on a worker in the cluster specified by the default cluster profile. The function returns j, a handle to the job object that runs the expression.

By default, workspace variables are copied from the client to workers when you run batch(expression). Job and task objects are not copied to workers.

j = batch(myCluster,script) is identical to batch(script) except that the script runs on a worker in the cluster specified by the cluster object myCluster.

j = batch(myCluster,expression) is identical to batch(expression) except that the expression runs on a worker in the cluster specified by the cluster object myCluster.

j = batch(fcn,N,{x1,...,xn}) runs the function fcn on a worker in the cluster specified by the default cluster profile. The function returns j, a handle to the job object that runs the function. The function is evaluated with the given arguments, x1,...,xn, and returns N output arguments. The function file for fcn is copied to the worker. (Note: Do not include the .m file extension with the function name argument.)

example

j = batch(myCluster,fcn,N,{x1,...,xn}) is identical to batch(fcn,N,{x1,...,xn}) except that the function runs on a worker in the cluster specified by the cluster object myCluster.

example

j = batch(___,Name,Value) specifies options that modify the behavior of a job using one or more name-value arguments. These options support batch for functions and scripts, unless otherwise indicated. Use this syntax in addition to any of the input argument combinations in previous syntaxes.

example

Examples

collapse all

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant