Why does the Data Type Conversion block not convert very small numbers to boolean zeros in Simulink 7.1 (R2008a)?

5 views (last 30 days)
I use the Data Type Conversion block to convert values of data type double to data type boolean.
I configure the block with the following options:
- Output data type: boolean
- Input and output to have equal: Real World Value (RWV)
- Round integer calculations toward: Nearest
I expect an input value of 0.1 to be converted to a boolean 0, but it is converted to a boolean 1.
Any value other than zero is converted to boolean 1, with any setting in the block.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The ability to round small numbers to zero using the Data Type Conversion block is not available in Simulink.
To work around the issue, one may use the Rounding Function block before the Data Type Conversion block to obtain the expected boolean value. Please see the attached Simulink model for an example which illustrates this behavior.

More Answers (0)

Products


Release

R2008a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!