Set code mapping information for model function
setFunction(
sets code mapping information for the specified model function. Use this function to set the
function customization template, memory section, or function name for a model function. For
single-tasking periodic functions and Simulink® functions, you can use this function to set the argument specification,
including argument names, port type (input or output), type qualifiers, and argument order. myCodeMappingObj
,function
,Name,Value
)
In the model code mappings for model
myConfigModel
, configure the name of the generated C initialize
function as myInitFunction
.
cm = coder.mapping.api.get('myConfigModel'); setFunction(cm,'Initialize','FunctionName','myInitFunction');
In the model code mappings for model
myInitFunction
, configure the memory section for the periodic
single-tasking function as None
.
cm = coder.mapping.api.get('myInitFunction'); setFunction(cm,'Periodic','MemorySection','None');
In the model code mappings for model
myInitFunction
, configure the function customization template for the
periodic multitasking function for sample time D2 as FastFcn
.
cm = coder.mapping.api.get('myInitFunction'); setFunction(cm,'Periodic:D2','FunctionCustomizationTemplate','FastFcn');
In the model code mappings for model
myInitFunction
, configure the argument specification for Simulink function mySLFunc
as y=(u1, const
*u2)
.
cm = coder.mapping.api.get('myInitFunction'); setFunction(cm,'mySLFunc','Arguments','y=(u1, const *u2)');
myCodeMappingObj
— Code mapping objectCodeMapping
objectCode mapping object (model code mappings) returned by a call to function
coder.mapping.api.get
.
Example: myCM
function
— Model functionInitialize
| Terminate
| Periodic:slIdentifier
| Partition:slIdentifier
| PeriodicUpdate:slIdentifier
| PartitionUpdate:slIdentifier
| Reset:slIdentifier
| ExportedFunction:slIdentifier
| SimulinkFunction:slIdentifier
Model function for which to set code mapping property value. Specify one of the values listed in this table.
Type of Model Function | Value |
---|---|
Exported function | ExportedFunction: ,
where is the name of
the function-call Inport block in the model |
Initialize function | Initialize |
Partition function | Partition: , where
is a partition
name for an exported function or a function for the model that you explicitly
partition in the Simulink Schedule Editor. For example, P1 . |
Partition update function (model configuration parameter Single output/update function is cleared) | PartitionUpdate: ,
is a partition name for an exported function or a function for the model that
you explicitly partition in the Simulink Schedule Editor (for example, P1 ) |
Periodic, multitasking function | Periodic: , where
is an annotation
that corresponds the sample time period associated with a function for a
periodic partition of a multi-tasking model (for example, D1 )
|
Periodic, multitasking update function (model configuration parameter Single output/update function is cleared) | PeriodicUpdate: ,
where is an
annotation that corresponds the sample time period associated with a function
for a periodic partition of a multi-tasking model (for example,
D1 ) |
Periodic, single-tasking function | Periodic |
Periodic, single-tasking update function a (model configuration parameter Single output/update function is cleared) | PeriodicUpdate |
Reset function | Reset: , where
is the name of
the reset function in the model |
Simulink function | SimulinkFunction: ,
where is the name of
the Simulink function in the model |
Terminate function | Terminate |
Model function for which to return a code mapping property value. Specify one of the values listed in this table. If model configuration parameter Single output/update function is cleared, you can specify the update version of a partition, periodic multi-tasking, or periodic singletasking function.
Type of Model Function | Value |
---|---|
Exported function | ExportedFunction: ,
where is the name of
the function-call Inport block in the model |
Initialize function | Initialize |
Partition function | Partition: , where
is a partition
that was created explicitly from a block in the model and shown in the
Simulink Schedule Editor (for example, P1 ) |
Partition update function | PartitionUpdate: ,
is a partition that was created explicitly from a block in the model and shown
in the Simulink Schedule Editor (for example, P1 ) |
Periodic multitasking function | Periodic: , where
is an annotation
that corresponds to the sample time period for a periodic or continuous rate of
a multi-tasking model (for example, D1 ) |
Periodic multitasking update function | PeriodicUpdate: ,
where is an
annotation that corresponds to the sample time period for a periodic or
continuous rate of a multi-tasking model (for example, D1 )
|
Periodic single-tasking function | Periodic |
Periodic single-tasking update function | PeriodicUpdate |
Reset function | Reset: , where
is the name of
the reset function in the model |
Simulink function | SimulinkFunction: ,
where is the name of
the Simulink function in the model |
Terminate function | Terminate |
For information about model partitioning, see Create Partitions.
Example: 'Periodic:D1'
Specify comma-separated pairs of Name,Value
arguments.
Name
is the argument name and Value
is the
corresponding value. Name
must appear inside quotes. You can specify
several name and value pair arguments as Name1,Value1,…,NameN,ValueN
. The
order of the name and value pair arguments does not matter.
'FunctionCustomizationTemplate'
— Name of function customization templateName of a function customization template defined in the Embedded Coder Dictionary
associated with the model, specified as a character vector or string scalar. If you
set the default function customization template for a category of functions to
Default
, you can specify a memory section for the functions
category.
Data Types: char
| string
'MemorySection'
— Name of memory section Name of a memory section that is defined in the Embedded Coder Dictionary associated with the model, specified as a character vector or string scalar.
Data Types: char
| string
'FunctionName'
— Name of functionName for the entry-point function in the generated C code, specified as a character vector or string scalar.
Data Types: char
| string
'Arguments'
— Argument specificationArgument specification for the entry-point function in the generated C code,
specified as a character vector or string scalar. The specification is a function
prototype that shows argument names, port types (input or output), type qualifiers,
and argument order (for example, y=(u1, const *u2)
.
Data Types: char
| string
coder.mapping.api.CodeMapping
| coder.mapping.api.get
| getFunction
| getFunctionDefault
| setFunctionDefault