I would like to convert data of double type to single type before code generation in 2020A Simulink, without using Cast blocks on most functions.

2 views (last 30 days)
I would like to do this without using Cast blocks on most functions.
  1 Comment
Scott McNeil
Scott McNeil on 7 Mar 2023
And what is the best way to build a model from the beginning in a smaller data type like uint16 wihout using many Cast blocks and Converters?

Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 7 Mar 2023
  3 Comments
Fangjun Jiang
Fangjun Jiang on 7 Mar 2023
The code generated after running set_param(gcs, 'DataTypeOverride', 'Single') shows using real32_T, which is float (single).
Scott McNeil
Scott McNeil on 8 Mar 2023
Thank you Fangjun Jiang. This was very helpful to get our model into Single Floating point which was very helpful to the Software coding process. I have also learned that changing to Fixed point types requires much more involvement during the code generating process. Some of the tools shared in the article were very good to learn.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!