Generating separate parameter files from build model in Simulink

13 ビュー (過去 30 日間)
Alec
Alec 2017 年 10 月 18 日
コメント済み: Survi Kyal 2018 年 10 月 26 日
Hi guys I'm new to Simulink and generating code. I am generating C code to an ert.tlc target file (Embedded Encoder). I have a question regarding the "Project_Name"_data.c file that is generated. It looks like this file generates the parameters of my model. I was wondering if it was possible to generate all the parameters to separate files rather than all of them in this one file. Here is a screenshot of what my MyModel_data.c file looks like. Any advice would be awesome!
  2 件のコメント
Survi Kyal
Survi Kyal 2018 年 10 月 24 日
I have the same question. Will update if I can find an answer.
Survi Kyal
Survi Kyal 2018 年 10 月 26 日
Figured out.
You can set the storage class for the constant parameters in your model by using Simulink Parameters. Instead of specifying:
%
var2 = 2
you can create a Simulink parameter and use that in your model:
%
var2 = Simulink.Parameter(2);
var2.CoderInfo.StorageClass = 'Custom';
var2.CoderInfo.CustomStorageClass = 'ExportToFile';
var2.CoderInfo.CustomAttributes.HeaderFile = 'test.h';
var2.CoderInfo.CustomAttributes.DefinitionFile = 'test.c';
This way you can make different parameters go to separate files.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by