Main Content

simulink.compiler.setExternalInputsFcn

Set callback to specify data to each external root inport port block at the start of each simulation step

Since R2020b

Description

in = simulink.compiler.setExternalInputsFcn(in, @(id, time) getInput(id, time)) function registers a callback that dynamically provides values for every external root input port block specified by id at the specified time at the root level of a model during simulation. The callback is required to return the value to be set at the inport block. To return the value from the callback, use the syntax, returningValue = getInput(id, time).

Input Arguments

collapse all

Simulation inputs and changes to model for simulation, specified as a Simulink.SimulationInput object

Example: in = Simulink.SimulationInput('vdp')

Function handle for callback to provide values for each root inport block specified by id at simulation step time, time.

  • id – A root inport block index, for which the callback is set, specified by a numerical value.

  • time – Time for which the input to the root inport block is required, specified by a numeric value.

Version History

Introduced in R2020b