Custom storage class for Argument Simulink parameters identifiable by TLC script

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

Answers (1)

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 storageclass name.
This behavior is expected because dictionaryapplied storage classes are not stored as direct perparameter 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 Comments

Hi, thank you for your answer.
I tried using a "myPackage.Parameter" parameter object as suggested but I could not use any of the Storage Classes for "Argument" parameters.
From your second link, I also tried investigating the "RTWInfo" field which looked promising. I could not find any in my test model even though I fullfill both conditions (parameters are Simulink.Parameter or derived from it, parameter symbols are preserved).
It looks like only the "MultiInstance" storage class is usable for "Argument" parameters, but it doesn't seem possible to create a custom storage class derived from MultiInstance in the Custom Storage Class Designer (in a package).
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 packagebased 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.

Sign in to comment.

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products

Release

R2024b

Asked:

on 11 Mar 2026 at 15:08

Commented:

on 17 Mar 2026 at 8:50

Community Treasure Hunt

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

Start Hunting!