Simulink.NumericType vs. Simulink.AliasType
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Thomas Becker
am 18 Dez. 2017
Bearbeitet: MathWorks Fixed Point Team
am 30 Jul. 2018
Hello,
I'm confused about the use of Simulink.NumericType and Simulink.AliasType objects in R2016b.
In the documentation of Simulink.AliasType there's the sentence "Alternatively, to define and name a numeric data type, you can use an object of the class Simulink.NumericType." - so what's the exact difference and what's the rule whether to use Simulink.AliasType or Simulink.NumericType?
For example, I'd like to have 2 variables, which define the global data type information for "speed" and "temperature", both having the data type uint8. Shall I have 2 Simulink.NumericType objects? Or 1 Simulink.NumericType object, which is referenced by 2 Simulink.AliasType objects?
Thanks a lot in advance
Thomas
0 Kommentare
Akzeptierte Antwort
MathWorks Fixed Point Team
am 30 Jul. 2018
Bearbeitet: MathWorks Fixed Point Team
am 30 Jul. 2018
Greetings,
the difference for these two primarily lies in code generation. For alias types you will be able to see the alias of the type used (the name you specified) in the generated code; instead numeric types will be typed to the native container (their corresponding data type). For example your 'speed' alias type will appear as a variable 'speed' in the generated code, while a numeric type will be typed as the defined data type.
There is a compatibility mode for numeric types that can make them act as alias in the generated code by using the 'isAlias' property set to true. This will cause the numeric type to perform similarly to an alias type in code generation but numeric types cannot reference other alias types.
For the example you mention if you are interested in maintaining the names of these variables in the generated code you should use an alias.
Thanks
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Fixed-Point Designer finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!