Why does SampleTime need to be defined as double?

I would like to define a parameter, to be used as SampleTime in block definitions, and I want that parameter to be generated in autocode as a single data type?

1 件のコメント

Sudarshan Kolar
Sudarshan Kolar 2017 年 2 月 28 日
I understand that you are trying to generate code from your Simulink model and you want the parameter "SampleTime" to be of data type single in the generated code.
SampleTime = Simulink.Parameter;
SampleTime.Value = 0.01;
SampleTime.DataType = 'single';
SampleTime.StorageClass = 'ExportedGlobal'; %to see the change
Hope that helps.

回答 (0 件)

この質問は閉じられています。

質問済み:

2017 年 2 月 22 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by