- 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 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
aida_p
il 16 Mar 2023
Modificato: Alexander Carmeli
il 13 Giu 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 Commenti
Risposta accettata
Abhijeet
il 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.
Più risposte (1)
Alexander Carmeli
il 13 Giu 2023
Modificato: Alexander Carmeli
il 13 Giu 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 Commenti
Vedere anche
Categorie
Scopri di più su String in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!