Main Content


Specify a MATLAB function to run before start of each simulation through SimulationInput object, in


in = in.setPreSimFcn(@(x) myfunction(arg1, arg2 ...)) runs before each simulation starts. The Simulink.SimulationInput object is passed as an argument x to this function. myfunction is any MATLAB® function and can be used to modify the Simulink.SimulationInput object. If you use myfunction to modify the Simulink.SimulationInput object, you must return Simulink.SimulationInput object as the only output argument.

Input Arguments

collapse all

This is an input to myfunction in which you can modify the Simulink.SimulationInput object.

Arguments specified to pass to the setPreSimFcn.

Introduced in R2017a