Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

ssSetInputPortSampleTime

Specify the sample time of an input port

Syntax

real_T ssSetInputPortSampleTime(SimStruct *S, int_T inputPortIdx,
 real_T period)

Arguments

S

SimStruct representing an S-Function block.

inputPortIdx

Index of the input port whose sample time is being set.

period

Sample period.

Returns

The real_T value of the sample time passed into the macro.

Description

Use in mdlInitializeSizes (after ssSetNumInputPorts) to specify the sample time period as continuous or as a discrete value for each input port. Input port index numbers start at 0 and end at the total number of input ports minus 1. For a continuous sample time, specify period as CONTINUOUS_SAMPLE_TIME. To inherit the sample time, specify period as INHERITED_SAMPLE_TIME. You should use this macro only if you have specified port-based sample times.

If the S-function specifies INHERITED_SAMPLE_TIME for any of its ports, the S-function should include an mdlSetInputPortSampleTime callback method. The callback method should set the sample time and offset of ports that inherit their sample time to the status that the Simulink® engine assigns to them using its sample time propagation rules. The callback method can also assign the sample times and offsets of other ports on the block whose sample times are inherited.

Languages

C, C++

Example

See the S-function sfun_multirate.c used in sfcndemo_sfun_multirate.

Introduced before R2006a

Was this topic helpful?