Data Type Conversion does not convert to boolean when attached to transfer function block
Show older comments
Hello,
I attached a "Data Type Conversion" block to a PT1 low pass filter (transfer function) trying to convert the ouptut signal from double to boolean. Unfortunately this did not work as expected - the output was constantly '1' or '0'.
The same issue appears when a logic block is used after the transfer function. (I assume the same type of conversion is made internally.)
I have to convert the double value to an integer first, and than to boolean. This does the trick but in principle it should not matter in which block a double value is created. Converting e.g. a pulse source double output directly to boolean works certainly.
This strange behavior has been encountered in 2018a and 2019a and with all possible conversion settings.
Any suggestions?
Thank you,
Timo
Here comes some additional information:
Block diagram

Simulation result at Conv1_out: directly converted to boolean

The direct conversion delivers a constant signal, only.
Simulation result at Conv2_out with first conversion block set to 'int8':

Now, the output looks as expected.
1 Comment
Fangjun Jiang
on 9 Jun 2020
It sounds unlikely and weird. Coud you post a simple example model?
Accepted Answer
More Answers (0)
Categories
Find more on Signal Attributes and Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!