- If the first argument of the fixdt() function is 0, the Simulink data type format will start with 'u', which means unsigned. If the first argument is 1, the Simulink data type format will start with 's', which means signed.
- The second argument of the fixdt() function specifies the number of bits in the data type. This can be directly translated to the Simulink data type format as 'intN' or 'uintN', depending on the sign of the data type.
- The third argument of the fixdt() function specifies the position of the binary point. If this value is positive, it means the binary point is to the right of the least significant bit, and the Simulink data type format should be suffixed with '_En', where N is the absolute value of the third argument. If the value is negative, it means the binary point is to the left of the most significant bit, and the Simulink data type format should be suffixed with '_E', followed by the absolute value of the third argument.
Display "fixdt" data type in Simulink format
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
aida_p
el 16 de Mzo. de 2023
Editada: Alexander Carmeli
el 13 de Jun. de 2023
Hi!
Is there is way to convert a data type information from 'fixdt(1,16,0)' format to the compiled Simulink data type format?
'fixdt(1,16,0)' --> 'int16'
fixdt(0,16,-5)' --> 'ufix16_E5'
'fixdt(1,5,12)' --> 'sfix5_En12'
I would like to get a simulink.parameter variable data type in this form.
Thanks!
0 comentarios
Respuesta aceptada
Abhijeet
el 5 de Abr. de 2023
Hi,
You can convert the data type information from 'fixdt(1,16,0)' format to the compiled Simulink data type format using the following rules:
For more information you can refer to the documentation - Fixdt
Hope this resolves your query.
Más respuestas (1)
Alexander Carmeli
el 13 de Jun. de 2023
Editada: Alexander Carmeli
el 13 de Jun. de 2023
The tostringInternalSlName() method does exactly that:
fixdt(1, 16, 0).tostringInternalSlName
fixdt(0, 16, -5).tostringInternalSlName
fixdt(1, 5, 12).tostringInternalSlName
You can find it on embedded.numerictype, and it works on Simulink.NumericType (what fixdt() produces) too.
methods(embedded.numerictype)
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!