- 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
21 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Abhijeet
on 5 Apr 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.
More Answers (1)
Alexander Carmeli
on 13 Jun 2023
Edited: Alexander Carmeli
on 13 Jun 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 Comments
See Also
Categories
Find more on String in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!