Main Content

fetchOutputs

Retrieve Simulink.SimulationOutput from Simulink.Simulation.Future objects

Description

simOut = fetchOutputs(Future) fetches the output from an array of Simulink.Simulation.Future objects, Future, after each element of Future is in a 'finished' state. fetchOutputs returns an array of Simulink.SimulationOutput objects.

example

Examples

collapse all

This example shows how to use the fetchOutputs method on an array of future objects to retrieve a Simulink.SimulationOutput array.

This example runs several simulations of the vdp model, varying the value of the gain Mu.

Open the model and define a vector of Mu values.

openExample('simulink_general/VanDerPolOscillatorExample');
open_system('vdp');
Mu_Values = [0.5,0.75,1,1.25];
MuVal_length = length(Mu_Values);

Using Mu_Values, initialize an array of Simulink.SimulationInput objects. To preallocate the array, a loop index is made to start from the largest value.

for i = MuVal_length:-1:1
    in(i) = Simulink.SimulationInput('vdp');
    in(i) = in(i).setBlockParameter('vdp/Mu',...
        'Gain',num2str(Mu_Values(i)));
end

Simulate the model using parsim. Set to 'RunInBackground' to enable the use of command prompt, while simulations are running.

Future = parsim(in,'RunInBackground','on');

Use the fetchOutputs method on Future

simOut = fetchOutputs(Future)
simOut = 

1x4 Simulink.SimulationOutput array

Input Arguments

collapse all

Array of Simulation.Simulink.Future objects. To create, Future, run parsim with 'RunInBackground' option set to 'on'.

Example: Future = parsim(in,'RunInBackground','on')

Output Arguments

collapse all

Array of Simulink.SimulationOutput objects that contain all of the logged simulation results. The size of the array is equal to the size of the array of Simulink.SimulationInput objects.

All simulation outputs (logged time, states, and signals) are returned in a single Simulink.SimulationOutput object. You define the model time, states, and output that are logged using the Data Import/Export pane of the Model Configuration Parameters dialog box. You can log signals using blocks such as the To Workspace and Scope blocks. The Viewers & Generators Manager tool can directly log signals.

Version History

Introduced in R2018a

See Also

Functions

Classes