Simulink data type conversion, single to uint16.
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jamie
el 18 de Sept. de 2024
Comentada: Jamie
el 25 de Sept. de 2024
Hello,
I'm using simulink and I need to convert from a single to a uint16.
Could a kind soul kindly explain why the output of a single (with range 0-2pi) equates to an uint16 of zero?
Here is an example:
And here is the output of that example:
There are a number of uint16 signals in my model with range 0-4000 (I am reading from sevreral ADC). All behave as expected. Just this conversion, in this instance.
5 comentarios
Respuesta aceptada
Hitesh
el 19 de Sept. de 2024
Editada: Hitesh
el 19 de Sept. de 2024
Hi Jamie,
I am assuming that you have used "Data Type Conversion" block, and the conversion to "uint16" resulted in unexpected values due to the default integer rounding mode being set to "floor" in Block Parameters. If you change the rounding mode to "round," you will achieve the expected results when converting from "single" to "uint16".
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Sources en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!