| Stateflow User's Guide | ![]() |
Sharing Fixed-Point Data with Simulink
If you plan on sharing fixed-point data with Simulink, use one of the following methods:
This means that the values that you enter for the Stored Integer and Scaling fields in the shared data's properties dialog in Stateflow (see Specifying Fixed-Point Data in Stateflow) must match similar fields that you enter for fixed-point data in Simulink. See Fixed-Point "Bang-Bang Control" Example for an example of this method of sharing input from Simulink data using a Gateway In block in Simulink.
For some Simulink blocks, you can specify the type of input or output data directly. For example, you can set fixed-point output data directly in the block parameters dialog of the Simulink Constant block when you select Specify via dialog for the Output data type mode field (under Show additional parameters).
Many blocks allow you to set their data types and scaling through inheritance from the driving block, or through backpropagation from the next block. This can be a good way to set the data type of a Simulink block to match the data type of the Stateflow port it connects to.
For example, you can set the Simulink Constant block to inherit its type from the Stateflow Input to Simulink port that it supplies by selecting Inherit via back propagation for the Output data type mode field in its block parameters dialog (under Show additional parameters).
For a general discussion of data compatibility between Simulink blocks, see "Unified Simulink and Fixed-Point Blockset Blocks" and "Compatibility with Simulink Blocks" in the Fixed-Point Blockset documentation.
| Overflow Detection for Fixed-Point Types | Fixed-Point "Bang-Bang Control" Example | ![]() |
© 1994-2005 The MathWorks, Inc.