Hauptinhalt

cancel

R2026b

Cancel all simulations associated with simulink.multisim.Future object

Since R2024a

Syntax

Description

cancel(f) stops all simulations associated with the simulink.multisim.Future object f. After cancellation, the State property changes to 'failed'. If simulations have already finished or failed, cancel has no effect.

example

Examples

collapse all

Cancel a batch of running simulations.

Run a large parameter sweep.

mdl = "vdp";
openExample("simulink_general/VanDerPolOscillatorExample",SupportingFile=mdl);

muValues = 1:0.05: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'

Calling cancel on a future object has no effect after simulations have finished or failed.

Run simulations and wait for completion.

muValues = [0.5:0.25:5];
paramRange = simulink.multisim.Variable("Mu",muValues);
exht = simulink.multisim.Exhaustive(paramRange);
stdy = simulink.multisim.DesignStudy(mdl,exht);

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

Call cancel on the future object after all the simulations have finished. The state remains 'finished'.

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

Input Arguments

collapse all

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

Version History

Introduced in R2024a