How can I convert a uint12 data to an int12 data in Simulink?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Thamira Joy Valentine
el 23 de Mzo. de 2020
Comentada: Thamira Joy Valentine
el 23 de Mzo. de 2020
I have a 12 bit length 2's complement data that will need to be converted into int12 format in Simulink. The data conversion block in simulink only has output options of int8, int16, int32 or int64. Padding the 12 bit data will resultingly make the conversion inaccurate. Is there a way to convert this the uint12 to int12 in Simulink? Similarly I will have the same issue with converting a uint20 to int20 and uint24 to int24.
0 comentarios
Respuesta aceptada
Fangjun Jiang
el 23 de Mzo. de 2020
If you have the fixed point toolbox, then it is straightforward. Define your data types and then use them anywhere in Simulink, treating them like the built-in types such as int8 or uint8.
>> MyInt12=fixdt(1,12,0);
>> MyUint12=fixdt(0,12,0)
MyUint12 =
NumericType with properties:
DataTypeMode: 'Fixed-point: binary point scaling'
Signedness: 'Unsigned'
WordLength: 12
FractionLength: 0
IsAlias: 0
DataScope: 'Auto'
HeaderFile: ''
Description: ''
Más respuestas (0)
Ver también
Categorías
Más información sobre String 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!