load

Load workspace variables from batch job

Syntax

load(job)
load(job,'X')
load(job,'X','Y','Z*')
load(job,'-regexp','PAT1','PAT2')
S = load(job ...)

Arguments

job

Job from which to load workspace variables.

'X' , 'Y', 'Z*'

Variables to load from the job. Wildcards allow pattern matching in MAT-file style.

'-regexp'

Indication to use regular expression pattern matching.

S

Struct containing the variables after loading.

Description

load(job) retrieves all variables from a batch job and assigns them into the current workspace. load throws an error if the batch runs a function (instead of a script), the job is not finished, or the job encountered an error while running, .

load(job,'X') loads only the variable named X from the job.

load(job,'X','Y','Z*') loads only the specified variables. The wildcard '*' loads variables that match a pattern (MAT-file only).

load(job,'-regexp','PAT1','PAT2') can be used to load all variables matching the specified patterns using regular expressions. For more information on using regular expressions, type doc regexp at the command prompt.

S = load(job ...) returns the contents of job into variable S, which is a struct containing fields matching the variables retrieved.

Examples

Run a batch job and load its results into your client workspace.

j = batch('myScript');
wait(j)
load(j)

Load only variables whose names start with 'a'.

load(job,'a*')

Load only variables whose names contain any digits.

load(job,'-regexp','\d')

Introduced in R2008a

Was this topic helpful?