- For a grouped storage class (such as "FlatStructure"), you can still specify the header file, by choosing the "Specify" option in the "header file" property. You can thus define all of their parameters in a single header file (ie, use the same header file for all their software components)
- If you need to provide a different header file for each of the instances, using a non-grouped storage class will provide this capability.
Why is "instance-specific" not an option for grouped Custom Storage Classes (e.g., FlatStructure) when using the Custom Storage Class Designer (cscdesigner) tool from Real-Time Workshop Embedded Coder?
2 views (last 30 days)
Show older comments
MathWorks Support Team
on 15 Nov 2011
Edited: MathWorks Support Team
on 5 Nov 2020
I would like more information on the differences between Unstructured and FlatStructured custom storage classes, and specifically why it is not possible to select an "instance specific" header file for grouped custom storage classes.
Accepted Answer
MathWorks Support Team
on 5 Nov 2020
Edited: MathWorks Support Team
on 5 Nov 2020
A grouped Custom Storage Class (such as "FlatStructure") combines multiple pieces of data into a single (grouped) data structure. All data related to a grouped Custom Storage Class must therefore have the same HeaderFile, DataScope, Initialization, etc., since they are all part of the same structure. Consequently, if a Custom Storage Class is grouped, no option exists to specify these Custom Storage Class attributes on an "instance-specific" basis.
You can follow the steps from this guided example in the documentation to compare how an unstructured (such as "Default") storage class would look as compare to the "FlatStructure" one.
Imagine an example such as the following one, containing three constants and a multiplexer:
Using a custom package and a custom storage class, it is possible to compare the results for both cases:
Code generated with "Default" storage class:
Code generated with "Struct" storage class:
As you can see in this last image, choosing a structured-type storage class will generate a structure containing C1, C2 and C3 (remember each of these is an instance of the custom storage class). Precisely because we have chosen the instances to be put together into a structure, it is not possible to break the code in a way such as a different header file can be provided for each of the instances.
Having a non-structured class, however, allows for the declarations to be present in different header files (one for each of the constant values).
0 Comments
More Answers (0)
See Also
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!