Main Content

getDataTransfer

Get code configuration from code mappings for signal representing data transfer

Since R2022b

Description

example

dataTransferService = getDataTransfer(coderMapObj,portHandle,"DataTransferService") returns the data transfer service for the signal corresponding to block output port, portHandle.

To configure the data transfer service, an Embedded Coder Dictionary that defines a service interface configuration must be attached to the model.

Examples

collapse all

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 getDataTransfer and setDataTransfer functions.

Open the component model, ComponentDeploymentFcn.

openExample("ComponentDeploymentFcn");

Get the code mappings for the model using the coder.mapping.api.get function.

cm = coder.mapping.api.get("ComponentDeploymentFcn");

In this model, the signal connecting two Function-Call Subsystem blocks, Accumulator and Integrator represents a data transfer. Get the current data transfer service configuration using the getDataTransfer function.

ph = get_param("ComponentDeploymentFcn/Integrator","PortHandles");
dataTransServ = getDataTransfer(cm,ph.Outport,"DataTransferService")
dataTransServ =

    'Dictionary default'
The signal representing the data transfer is configured to use the default data transfer service defined in the shared coder dictionary.

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, use the setDataTransfer function and set the DataTransferService property to DataTransferDuringExe.

setInport(cm,ph.Outport,"DataTransferService","DataTransferDuringExe")

Input Arguments

collapse all

Code mapping object (model code mappings) returned by a call to function coder.mapping.api.get.

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.

Output Arguments

collapse all

Name of the data transfer service of the specified signal.

Version History

Introduced in R2022b