主要内容

wait

R2026b

Wait for simulink.multisim.Future simulations to complete

Since R2024a

Syntax

Description

wait(f) blocks the MATLAB® command prompt until all simulations associated with the simulink.multisim.Future object f complete. If simulations have already finished or failed, wait returns without blocking.

Examples

collapse all

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

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 simulations with a specified output location.

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

Wait for completion and check the state.

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

Input Arguments

collapse all

Object representing running or completed simulations, created by calling parsim with a DesignStudy object.

Tips

  • wait does not return a value.

  • Use wait instead of fetchOutputs when you do not need to load the results into memory. Consider using wait with multisimDatastore to process results incrementally.

  • fetchOutputs calls wait internally, so you only need to call wait separately if you want to check state or timing properties before fetching outputs.

Version History

Introduced in R2024a