To regain access to model parameters in a structured way in MATLAB R2023 using MATLAB/Simulink Coder, you may need to adjust the code generation settings and possibly use new functionality to achieve a similar outcome as was available in MATLAB R2015. Here's a some of steps you could take:
- Review Code Generation Settings: Check "Code Generation" settings in the Model Configuration Parameters for parameter data and tunable parameters. Make sure they are configured to match your desired output.
- Use Simulink Data Dictionary: Manage parameters and signals through a Simulink Data Dictionary for more accessible data control.
- Define Custom Storage Classes: Create a custom storage class in the Simulink Coder Dictionary to store parameter data in a global structure.
- Check for Deprecated Features: Use the provided MATLAB command to review deprecated features and update your model accordingly.
- Employ Post-Code-Generation Command: Use the PostCodeGenCommand to manipulate the generated code to include functions or structures for accessing parameters.
- Seek Help from MATLAB Answers or MathWorks Support: For specific guidance on changes in code generation from older to newer MATLAB versions.
- Examine Generated Code: Look into the generated code for the current method of parameter storage and modify if necessary.
- Use Legacy Code Tool: Integrate old code with new models if certain functionalities are no longer supported directly.
- Consider Backward Compatibility: Make sure your model updates consider any backward compatibility issues.
Here's an example of how you might define a custom storage class to generate a global structure for parameters:
pkg = Simulink.data.createCustomStorageClassPackage('MyPackage', ...
'Description', 'A package of custom storage classes');
csc = Simulink.data.createClass(pkg, 'MyStorageClass', ...
'Description', 'A custom storage class for parameters', ...
'DataScope', 'Exported', ...
'HeaderFile', 'myParameters.h', ...
'GetFunction', 'myModel_GetParameters');
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.