MATLAB: How to globally change data types for code generation in Embedded Coder 6.0 (R2011a)

Embedded Coder

I would like to switch between single and double precision data types globally in my Simulink model. I would like to do this easily so I can generate code for each variation.

Best Answer

In order to mass-alter data types in a Simulink model you ust define a custom alias type, which, for example, can be switched between double and single to change the precision used in the model and the generated code.
All places that the type is defined to be double in your model will need to be defined as using the new alias type. Then, using the Simulink.AliasType window you will be able to change the type used from 'single' to 'double'.
Please read the Simulink.AliasTypes documentation for more details: