Main Content

Simulink.CodeImporter.ParseInfo Class

Namespace: Simulink.CodeImporter

Information about parsed custom code

Since R2021a

Description

The 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.

The Simulink.CodeImporter.ParseInfo class is a handle class.

Creation

When you create an object of class Simulink.CodeImporter, an object of class Simulink.CodeImporter.ParseInfo is automatically created as the ParseInfo property of that object. Do not create an object of class Simulink.CodeImporter.ParseInfo directly.

Properties

expand all

Whether parsing of custom code is successful, specified as a logical scalar with value false before successful parsing of specified custom code, then true after successful parsing.

Data Types: logical scalar

Functions compatible with Simulink in custom code, returned as a string array.

Example: ["myCustomFcn1", "myCustomFcn2", "myCustomFcn3"]

Data Types: string array

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 AvailableFunctions.

Example: ["myCustomFcn1", "myCustomFcn3"]

Data Types: string array

Data types compatible with Simulink in custom code, returned as a string array. Types are user-defined, such as struct and enum.

Example: ["myStruct1","myStruct2"]

Data Types: string array

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 true), Errors is a null vector.

Data Types: character vector

Methods

expand all

Examples

collapse all

Create a code importer object.

obj = Simulink.CodeImporter;

Set the library name and the 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"];
parse(obj);
obj.ParseInfo
ans = 

  ParseInfo with properties:

               Success: 1
    AvailableFunctions: ["Controller"    "setFanTempThreshold"    "setPumpTempThreshold"]
        EntryFunctions: ["Controller"    "setFanTempThreshold"    "setPumpTempThreshold"]
        AvailableTypes: "pump_control_bus"
                Errors: []

Version History

Introduced in R2021a