Set code configuration in code mappings for signal representing data transfer
To configure the data transfer service, an Embedded Coder Dictionary that defines a service interface configuration must be attached to the model.
Configure the Data Transfer Service for a Signal
This example model references a shared coder dictionary that defines
the default data transfer services for signals representing data transfers. To configure
the data transfer to use something other than the default service, use the
Open the component model,
Get the code mappings for the model using the
cm = coder.mapping.api.get('ComponentDeploymentFcn');
In this model, the signal connecting two Function-Call Subsystem blocks,
Integrator represents a data transfer. Get the current data
transfer service configuration using the
ph = get_param('ComponentDeploymentFcn/Integrator', 'PortHandles'); dataTransServ = getDataTransfer(cm, ph.Outport, 'DataTransferService')
dataTransServ = 'Dictionary default'
To configure the signal to communicate data with other functions immediately during
function execution instead of before or after execution as specified in the dictionary,
setDataTransfer function and set the
DataTransferService property to
setInport(cm, ph.Outport, 'DataTransferService',... 'DataTransferDuringExe')
myCodeMappingObj — Code mapping object
Code mapping object (model code mappings) returned by a call to function
portHandle — Output port handle of signal source block
Port handle for block output signal representing a data transfer. In a component model, signal lines connecting communicating functions represent data transfers in the generated code. Communicating functions are modeled using Function-Call Subsystem blocks that are aperiodic or periodic functions.
myDataTransferService — Name of data transfer service
Dictionary default (default) | character vector | string scalar
String or character vector containing the name of a data transfer service interface
defined in the Embedded Coder Dictionary. To use the dictionary default, specify
In the Embedded Coder Dictionary, you can configure the data transfer services to one of the following:
Outside execution: The platform communicates data with other functions outside (before and after) function execution.
During execution: The platform service communicates data with other functions immediately during function execution.
For more information on data communication methods, see Data Communication Methods.
Introduced in R2022b