Use the programmatic interface to retrieve and configure properties of functions in the code mappings of a Simulink model.
To interactively observe how your commands are reflected in the Code Mappings editor, make sure the Code Mappings editor is open with the Functions tab selected. To learn how to open the Code Mappings editor, see Open the Code Mappings Editor – C.
Open the model ECoderMapAPI
.
Get the code mappings object of the model.
Get the FunctionName
property of the periodic function and the initialization function.
periodicFcnName =
'myPeriodicFcn'
InitFcnName =
'myInitFcn'
Generate code from the model.
Entry-point functions are declared in the model header file. Store the header file name in the variable model_h_file
.
model_h_file =
"ECoderMapAPI_ert_rtw/ECoderMapAPI.h"
This is the declaration of the entry-point functions in the header file:
/* Model entry point functions */
extern void myInitFcn(void);
extern void myPeriodicFcn(void);
The function names are the names stored in periodicFcnName
and InitFcnName
.
To open the header file, enter this command in the MATLAB Command Window:
Rename the periodic functions.
Generate code from the model again with the new entry-point function names.
This is the updated declaration of the entry-point functions in the header file.
/* Model entry point functions */
extern void yourInitFcn(void);
extern void yourPeriodicFcn(void);
The function names are updated.