MATLAB Answers


Is there a way to force Simulink Coder in R2018B to output header files in the same format as R2013B?

Asked by Keane Gonzalez on 5 Aug 2019
Latest activity Answered by Chidvi Modala on 8 Aug 2019
I've got a lot of code that's put through simulink coder in R2013B, which outputs its nice set of header/include files. To go along with this, we've written tools to read through those files and do some user side mapping for our own code (basically, we're using simulink models coded to C and then included with our larger set of software, but we have hooks in our software to set certain parameters from the R2013B produced code). Since we're parsing the .h files from the simcode and doing some stuff with it, the new format in R2018B (not sure when the .h styles changed, maybe 2014?) is causing some pains. Is there a way to force the R2018 version to write out in the same text formatting as R2013B (comment placement, use of main block parameters and BlockIO, etc...)?
We are upgrading our tools from R2013B which runs with Visual Studio 2012 to R2018B running with Visual Studio 2015. As a summary of what we do, we read in the .h files linked to the main .h and then read and parse all of the structs and declarations to produce a mapping to show us the long naming (like a.b.c.d.e is a double). With the R2018 produced format, not everything flows from one main struct setup (to get to all items, there was a main parameter block that had a tree touching almost every other variable).
Any ideas on if this is a user setting available in R2018 (or R2017)?


Sign in to comment.




1 Answer

Answer by Chidvi Modala on 8 Aug 2019

In MATLAB R2014a, code generation no longer creates rtw_shared_utils.h. Code generation for a model produces code which directly includes only those header files required for the code. For subsystems, code generation includes only those header files required for the subsystem code. The generated code is more deterministic.
In MATLAB R2018a, you can retrieve meta information about generated code using MATLAB API.
In MATLAB R2019a, you can retrieve information about internal data in the generated code by using Code Descriptor API


Sign in to comment.