Mask Parameter Visibility Affects Code Generation

I have a masked subsystem with a parameter that is set by the initialization code in the mask to be equal to a Simulink.Parameter that is pre-defined in the base workspace as follows:
my_param = Simulink.Parameter;
my_param.Value = int32(0);
my_param.RTWInfo.StorageClass = 'ExportedGlobal';
my_param.DataType = 'int32';
When I generate code (using embedded coder) for my model, if the visibility is set on my mask parameter to 'on' such that it is visible in the Block Parameters dialog, the code generates properly and the parameter is an exported global variable in the resulting C code. If, on the other hand, I set the visibility to 'off', and the parameter is no longer visible in the Block Parameters dialog (recall that it's value is set by the initialization code in the mask so I don't need it visible in the block settings dialog), the generated code results in a variable that uses auto storage and is not exported regardless of the values in the RTWInfo in the Simulink.Parameter.
I have two questions based on the above observations:
1) Why does the visibility property determine how code is generated for a parameter?
2) Is there another way I can have a parameter that is not visible in the Block Settings dialog that will generate code with the proper storage class?
All work is being done in R2011B.
Thanks!
Jeff

1 件のコメント

Kaustubha Govind
Kaustubha Govind 2011 年 11 月 4 日
Jeff: I would recommend contacting Tech Support for this. I'm not sure if this is possible, but you can get a more authoritative answer and also put in an enhancement request at the same time (if there is no workaround).

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

質問済み:

2011 年 11 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by