Contenido principal

simulink.multisim.Future

R2026b

Track progress and retrieve results of design study simulations

Since R2024a

Description

Use the Future object to track simulation progress, wait for completion, retrieve outputs, or cancel running simulations.

Creation

To create a simulink.multisim.Future object, call parsim with a simulink.multisim.DesignStudy object as the input argument.

Properties

expand all

This property is read-only.

Current aggregated state of all simulations associated with this future, returned as one of the following values:

  • 'queued' — Simulations are queued but none have started running.

  • 'running' — At least one simulation is running.

  • 'finished' — All simulations completed successfully.

  • 'failed' — One or more simulations encountered an error or were canceled.

Data Types: char

This property is read-only.

Number of simulations, specified as a double.

Data Types: double

This property is read-only.

Number of parallel workers, specified as a double.

Data Types: double

This property is read-only.

Date and time when the future object was created, represented as a datetime object.

Data Types: datetime

This property is read-only.

Date and time when the first simulation began running, represented as a datetime object.

Data Types: datetime

This property is read-only.

Date and time when the last simulation finished, represented as a datetime object. This property is empty if simulations have not yet completed.

Data Types: datetime

This property is read-only.

Total running time of all simulations, represented as a duration.

Data Types: duration

Object Functions

MethodDescription
cancelCancel a pending, queued, or running simulink.multisim.Future object
fetchOutputsRetrieve all simulation outputs from simulink.multisim.Future
waitWait for simulink.multisim.Future object to complete simulations

Examples

collapse all

Run a design study using the vdp model and retrieve the simulation results from the simulink.multisim.Future object.

Define a parameter sweep for Mu and create a design study.

mdl = "vdp";
openExample("simulink_general/VanDerPolOscillatorExample",SupportingFile=mdl);
muValues = [0.5:0.25:5];

paramRange = simulink.multisim.Variable("Mu",muValues);
exht = simulink.multisim.Exhaustive(paramRange);
stdy = simulink.multisim.DesignStudy(mdl,exht);

Run the design study using parsim. The parsim function returns a simulink.multisim.Future object.

f = parsim(stdy);
f.State
ans =
    'running'

Fetch all outputs. The fetchOutputs function waits until all simulations finish.

outputs = fetchOutputs(f)
outputs =
  19x1 Simulink.SimulationOutput array

Run simulations with a specified output location and use wait to block execution until all simulations complete.

Run simulations with the output location set to the present working folder.

outputDir = fullfile(pwd,"myResults");
mkdir(outputDir);
f = parsim(stdy,OutputLocation=outputDir);

Wait for completion and check the state.

wait(f);
f.State
ans =
    'finished'

Cancel a set of running simulations.

Run a large parameter sweep.

muValues = 1:0.1:10;
paramRange = simulink.multisim.Variable("Mu",muValues);
exht = simulink.multisim.Exhaustive(paramRange);
stdy = simulink.multisim.DesignStudy(mdl,exht);

f = parsim(stdy);
f.State
ans =
    'running'

Cancel the running simulations.

cancel(f);
f.State
ans =
    'failed'

Version History

Introduced in R2024a