Mask Parameter Visibility Affects Code Generation
Show older comments
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 Comment
Kaustubha Govind
on 4 Nov 2011
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).
Answers (0)
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!