Set the sample time of an input port that inherits its sample time from the port to which it is connected
SetInputPortSampleTime(s, port, time)
Simulink.MSFcnRunTimeBlockclass representing the Level-2 MATLAB S-Function block.
Integer value specifying the index of port whose sampling mode is to be set.
[period offset], that specifies the period and offset of the times that this port samples its input.
The Simulink® engine invokes this method with the sample
port inherits from the port to which
it is connected.
For Level-2 MATLAB S-functions, if the inherited sample time is acceptable, this method sets the sample time and offset time using the line
s.InputPort(port).SampleTime = time;
The engine calls this method until all input ports with inherited sample times are specified.
When inherited port-based sample times are specified, the sample
time is guaranteed to be one of the following where
period < inf and
0.0 <= offset < period.
|Sample Time||Offset Time|
Constant, triggered, and variable-step sample times are not propagated to S-functions with port-based sample times.
SetInputPortSampleTime is called
once per port with the input port sample time. However, there can
be cases where this function is called more than once. This happens
when the simulation engine is converting continuous sample times to
continuous but fixed in minor steps sample times. When this occurs,
the original values of the sample times specified in
restored before this method is called again.
The final sample time specified at the port can be different from (but equivalent to) the sample time specified by this method. This occurs when
The model uses a fixed-step solver and the port has a continuous but fixed in minor step sample time. In this case, the Simulink engine converts the sample time to the fundamental sample time for the model.
The engine adjusts the sample time to be as numerically sound as possible. For example, the engine converts
The S-function can examine the final sample times in