Writing S-Functions Previous page   Next Page
mdlSetOutputPortSampleTime

Set the sample time of an output port that inherits its sample time from the port to which it is connected

C Syntax

C Arguments

S
   SimStruct representing an S-Function block.

port
   Index of a port.

sampleTime
   Inherited sample time for port.

offsetTime
   Inherited offset time for port.

M Syntax

M Arguments

s
   Instance of Simulink.MSFcnRunTimeBlock class representing the S-Function block.

port
   Integer value specifying the index of port whose sampling mode is to be set.

time
   Two-element array, [period offset], that specifies the period and offset of the times that this port produces output.

Description

Simulink calls this method with the sample time that port inherits from the port to which it is connected. If the inherited sample time is acceptable, this method should set the sample time of port to the inherited sample time, using ssSetOutputPortSampleTime or

in the case of a Level-2 M-file S-function.

If the inherited sample time is unacceptable, this method should generate an error via ssSetErrorStatus. Note that this method can set the sample time of any other input or output port whose sample time derives from the sample time of port, using ssSetInputPortSampleTime or ssSetOutputPortSampleTime or the SampleTime property of the Simulink.PortData object associated with the port in the case of Level-2 M-file S-functions.

Normally, sample times are propagated forward; however, if sources feeding this block have inherited sample times, Simulink might choose to back-propagate known sample times to this block. When back-propagating sample times, we call this method in succession for all inherited output port signals.

See mdlSetInputPortSampleTime for more information about when this method is called.

Languages

C

See Also

ssSetOutputPortSampleTime, ssSetErrorStatus, ssSetInputPortSampleTime, ssSetOutputPortSampleTime, mdlSetInputPortSampleTime, Simulink.MSFcnRunTimeBlock, Simulink.PortData


Previous page  mdlSetOutputPortDimensionInfo mdlSetOutputPortWidth Next page

© 1994-2005 The MathWorks, Inc.