This model shows ASAP2 data export. ASAP2 is a data definition standard proposed by the Association for Standardization of Automation and Measuring Systems (ASAM).
When you use a MATLAB® structure to specify initialization values for the signal elements in a bus, you can create a tunable global structure in the generated code.
Stateflow and MATLAB Coder can fully define their data definitions, or they can inherit them from Simulink. Data definition capabilities include:
This model illustrates the target-based C API for interfacing signals, parameters, and states in the generated code.
You can represent initial conditions for signals and states by creating tunable global variables in the generated code. These variables allow you to restart an application by using initial
This model shows a fixed-point version of an acoustic noise canceller.
This model shows fixed-point code generation in Simulink®, Stateflow®, and MATLAB®.
To store multiple independent sets of values for the same block parameters, you can use an array of structures. To switch between the parameter sets, create a variable that acts as an index
As you iteratively develop a model, you capture output signal and state data that model execution generates. You also tune parameter values during execution to observe the effect on the
These examples show how to generate efficient code by configuring a block parameter to use the same data type as a signal that the block operates on.
When you use a parameter object (for example, Simulink.Parameter) to set block parameter values, you can configure the object to appear in the generated code as a tunable global variable. By
Create tunable parameter data by representing block parameters as global variables in the generated code.
The data interface of a model is the means by which the model exchanges data (for example, signal values) with other, external models or systems. Customize the data interface of a model to:
When you use a Simulink.Parameter object or a numeric MATLAB variable to set two or more block parameter values, if the block parameters have different data types, you must explicitly
Encapsulate a C++ class interface in generated code. Customize C++ class interfaces for referenced models and how models interact through those interfaces.
Import specifications from an interface control document (ICD), configure code generation settings for a model according to the specifications, and store the settings in data
Apply the custom storage class GetSet to nonvirtual bus signals and structure parameters in a model.
To specify code generation options for signal lines, block parameters, and states in a model, you can use data objects that you store in a workspace or data dictionary. For basic information
Configure the generated code to use a data type name (typedef) that you specify.
This model shows how to insert pragmas for functions and data in generated code.
Suppose your external code conditionally allocates memory for and initializes lookup table and breakpoint set data based on a dimension length that you specify as a #define macro. This
This model shows the Generate an example main program feature of Embedded Coder®. The model is configured to generate a main program suitable for deployment on a bare-board target (one with
Configure a model for reentrant, multi-instance code generation. Multiple programs can use reentrant code simultaneously. When you configure a model for reentrancy, the execution
These examples show how to control the file placement of data items (signals, parameters, and states) to which you apply storage classes and custom storage classes.
This model shows user-defined types, consisting of numeric and alias types. Numeric types allow you to define abstract numeric types, which is particularly useful for fixed-point types.
Create and name a fixed-point data type in generated code. You can use the name of the type to specify parameter and signal data types throughout a model and in generated code.
Customize the signatures of the model step and initialize functions.
Generate code that imports a parameter value from your external code.
Custom storage classes allow you to declare and interface with virtually any type of data. This model shows three of the several predefined custom storage classes provided with Embedded
Apply the custom storage class GetSet to signals and parameters that are matrices.
Apply uniform naming rules for Simulink® data objects, including signals, parameters, and data store memory variables.
Apply the custom storage class GetSet to signals and parameters that are vectors.
How the generated code initializes signal, state, and parameter data.
Avoid introducing a double-precision data type in code generated for a single-precision hardware target.
Generate code that uses global data that some handwritten code defines. In the handwritten code, a pointer variable points to one of two structure variables that contain parameter data. A
To integrate the generated code with your own external code, you can configure data items in a model, such as signal lines and block parameters, to appear in the generated code as global
Generate code that interfaces with legacy code by using specialized get and set functions to access data.
How the generated code stores internal data such as block states.
Configure code generation settings for a model according to specifications in an interface control document (ICD). Store necessary Simulink variables and objects, such as