Is there any way to change default data type of simulink models, including embedded matlab functions in simulink?
24 views (last 30 days)
Show older comments
Is there any way to change default data type of simulink models, including embedded matlab functions in simulink?
When I change default data type for unspecified data, it has no afffect to embedded matlab functions inside simulink model. You have to "cast" every variable separately to data type you want to in this particular function.
0 Comments
Answers (1)
Jonas
on 4 Mar 2020
Edited: Jonas
on 4 Mar 2020
You can choose between double or single in the 'Default for unspecified data' menu as you mentioned.
If you see no or little effect in your generated code, you have specified other data types in certain blocks, and with 'Inherit' data types in other blocks, all data types will be linked to that data type.
I suggest to enable Data type view on signals by enabling Display -> Signals & Ports -> Port Data Types and debug your model to see from where Simulink derives its data types.
4 Comments
Jonas
on 6 Mar 2020
Embedded MATLAB functions are something different inside Simulink. Data types are double by default for Embedded functions and are not affected by the setting of 'Default for unspecified data'.
See Also
Categories
Find more on Simulink Functions 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!