Custom storage class for Argument Simulink parameters identifiable by TLC script
Afficher commentaires plus anciens
Hi,
My objective is to define a custom storage class specifically intended for "Argument" Simulink parameters. The primary requirement is to programmatically identify which model parameters are using this custom storage class from within a TLC script executed during code generation.
I initially attempted to create the custom storage class using an Embedded Coder Dictionary. However, at code generation time, I have been unable to definitively determine which model parameters are using my custom storage class. The only observable indicator appears to be the field ModelParameters.Parameter[i].IsSpecifiedAsNewStorageClass, which is set to 1. I would appreciate confirmation on whether this is the intended mechanism or if additional fields should be accessible.
I subsequently explored the Custom Storage Class Designer, which showed promise. Upon inspection, the custom storage class appeared clearly within the TLC script context under the CustomStorageClasses record. However, as far as I know, it is not possible to define a custom storage class for "Argument" Simulink parameters this way.
Are there any aspects of either methodology that I may have overlooked or configured incorrectly?
Is there an alternative approach or recommended candidate method that would better satisfy my requirements?
Best regards
Réponses (1)
Isha
le 16 Mar 2026 à 9:41
0 votes
Hello,
When you define a storage class only in an Embedded Coder Dictionary, TLC often exposes only “ModelParameters.Parameter[i].IsSpecifiedAsNewStorageClass” and not the actual storage‑class name.
This behavior is expected because dictionary‑applied storage classes are not stored as direct per‑parameter fields in model.rtw.
If you instead create your storage class in a package using the Custom Storage Class Designer and then refer the package from the model’s Embedded Coder Dictionary, TLC can see your Custom Storage Class under "CustomStorageClasses", and each parameter’s "RTWInfo.StorageClass" / "CustomStorageClass" via its Object record.
This method does work for model parameter arguments, as long as the arguments are actual parameter objects (e.g., Simulink.Parameter / myPackage.Parameter) and the package is attached to the dictionary.
Hope this helps.
2 commentaires
Adrien
le 17 Mar 2026 à 8:03
Isha
le 17 Mar 2026 à 8:50
Hello,
You can’t apply a CSC‑Designer (package‑based) custom storage class to Argument parameters. Argument parameters only support storage classes defined inside the Embedded Coder Dictionary, mainly MultiInstance or a duplicate of it.
That’s why your package‑based CSC never appears as selectable for Argument parameters.
In the Embedded Coder Dictionary, duplicate MultiInstance and create your custom Argument storage class then assign it to Argument parameters through Code Mappings. If TLC must know exactly which parameters use it, the most reliable method is to precompute that list using the Code Mappings API before build and pass it to TLC.
Hope this helps.
Catégories
En savoir plus sur Deployment, Integration, and Supported Hardware dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!