Main Content


List of files automatically attached to the Simulink.Simulation.Job object or parallel pool



listAutoAttachedFiles(simJob) performs a dependency analysis on the Simulink.Simulation.Job job object, simJob. Then it displays a list of the code files that are already attached or are going to be automatically attached to the job object, simJob.


collapse all

This example shows how to run parallel simulations in batch and list any attached files. batchsim offloads simulations to the compute cluster, enabling you to carry out other tasks while the batch job is processing, or close the client MATLAB® and access the batch job later.

1. Open the model.


2. Define a set of values for different temperatures.

setPointValues = 65:2:85;
spv_Length = length(setPointValues);

3. Using the setPointValues, initialize an array of Simulink.SimulationInput objects.

in(1:spv_Length) = Simulink.SimulationInput('sldemo_househeat');
for i = 1:1:spv_Length 
    in(i) = in(i).setBlockParameter('sldemo_househeat/Set Point',...

4. Specify the pool size of the number of workers to use. In addition to the number of workers used to run simulations in parallel, a head worker is required. In this case, assume that three workers are available to run a batch job for the parallel simulations. The job object returns useful metadata as shown. You can use the job ID to access the job object later from any machine. NumWorkers displays how many workers are running the simulations – the number of workers specified in the 'Pool' argument plus an additional head worker.

simJob = batchsim(in,'Pool',3)
                  ID: 1
                Type: pool
          NumWorkers: 4
            Username: #####
               State: running
      SubmitDateTime: ##-###-#### ##:##:##
    Running Duration: 0 days 0h 0m 0s

If AutoAttachFiles property of Simulink.Simulation.Job is set to true in the cluster profile, then the job running on the cluster has the necessary code files automatically attached to it. Use the listAutoAttachedFiles method to view the attached files.

Note that the list of attached files is not displayed here because this is an example model.


Input Arguments

collapse all

A Simulink.Simulation.Job object. To create a simJob, run batchsim.

Example: simJob = batchsim(in,'Pool',4)

Version History

Introduced in R2018b