This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

fetchOutputs

Retrieve Simulink.SimulationOutput from Simulink.Simulation.Future objects

Syntax

simOut = fetchOutputs(Future)

Description

example

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.

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.

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 Signal & Scope Manager tool can directly log signals.

Introduced in R2018a