Information about parsed custom code
Simulink.CodeImporter.ParseInfo class has read-only properties that
store more information about the parsed custom code. Parsing needs to be successful to obtain
information regarding custom code.
Simulink.CodeImporter.ParseInfo class is a
When you create an object of class
Simulink.CodeImporter, an object of
Simulink.CodeImporter.ParseInfo is automatically created as the
ParseInfo property of that object. Do not create an object of class
Success— Whether parsing of custom code is successful
Whether parsing of custom code is successful, specified as a logical scalar with
false before successful parsing of specified custom code, then
true after successful parsing.
AvailableFunctions— Functions compatible with Simulink® in custom code
Functions compatible with Simulink in custom code, returned as a string array.
EntryFunctions— Entry-point functions in custom code
Entry-point functions in custom code, returned as a string array. Entry-point
functions are not called by other custom code functions.
EntryFunctions is a subset of
AvailableTypes— Data types compatible with Simulink in custom code
Data types compatible with Simulink in custom code, returned as a string array. Types are user-defined, such
Errors— Error messages from failed parse
Error messages from failed parse of the specified custom code
Sucesss is equal to
false), returned as a
character vector. Multiple error message are concatenated into a single character
vector. If the parsing is successful (
Sucesss is equal to
Errors is a null vector.
obj = Simulink.CodeImporter; %% Set library file name and output folder obj.LibraryFileName = "pumpController"; obj.OutputFolder = "."; %% Set the custom code to import obj.CustomCode.InterfaceHeaders = ["pumpController.h"]; obj.CustomCode.IncludePaths = ["./include"]; obj.CustomCode.SourceFiles = ["src/pumpController.c" "src/utils.c"]; obj.parse; obj.ParseInfo
ans = ParseInfo with properties: Success: 1 AvailableFunctions: ["Controller" "setFanTempThreshold" "setPumpTempThreshold"] EntryFunctions: ["Controller" "setFanTempThreshold" "setPumpTempThreshold"] AvailableTypes: "pump_control_bus" Errors: