フィルターのクリア

How to change the real_T in generated C code to be float type?

17 ビュー (過去 30 日間)
Yunlong Wang
Yunlong Wang 2016 年 3 月 27 日
コメント済み: Rami Al Halabi 2016 年 3 月 27 日
Hi, I am now using Matlab2015b. I use the Code Generation of simulink to convert the algorithm inside Matlab Function into C code. In the generated code, I found that the real_T is float, as shown below
typedef doulbe real_T;
However, I hope that real_T could be float, so that the calculation time needed inside my ARM chip could be saved a lot.
I know that one method is specifying every variable with single() function, but there are so many variables inside my algorithm. So is there some other better methods? Thank you.

回答 (1 件)

Rami Al Halabi
Rami Al Halabi 2016 年 3 月 27 日
have you tried replacing double by float in that typedef statement?
typedef float real_T;
  2 件のコメント
Yunlong Wang
Yunlong Wang 2016 年 3 月 27 日
編集済み: Yunlong Wang 2016 年 3 月 27 日
Hi Rami, thank you. I have done that. I works well, but I have to modify the generated code each time after code generation. Is there some other better methods?
Rami Al Halabi
Rami Al Halabi 2016 年 3 月 27 日
No problem. Not sure if there is a setting in matlab that allows you to specify whether you want single or double precision. If you find any, please share it here :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by