Code Mappings Editor
R2026bConfigure DDS inports and outports as DataReaders and DataWriters
Description
The Code Mappings Editor lets you configure model inports and outports as DDS DataReaders and DataWriters, select Topics, and specify QoS to connect your application to a DDS network.
Use the Inports and Outports sections in the Code Mappings editor to configure the inports and outports respectively.
Open the Code Mappings Editor
MATLAB® Toolstrip: In a DDS Blockset model, on the DDS tab, click Code Interface and select Individual Element Code Mappings.
The Code Mappings editor appears as a minimized tab directly below the model canvas in a DDS Blockset model. Click the tab to expand the editor.
Examples
Configure DataReaders and DataWriters by Using Default Behavior
This example uses the Shapes Demo example model to show how to configure the DataReaders and DataWriters for a DDS application by using default behavior.
Open the Shapes Demo example model,
shapesdemo.openExample('shapesdemo');Create DDS definitions. In the DDS Application Quick Start, on the second page, select Create and use default dictionary.
Open the Code Mappings editor. On the DDS tab, click Code Interface and select Individual Element Code Mappings.

Configure the inports. The inports represent DataReaders in a DDS application.
Select the Topic. Set the Topic to the Square Topic specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Square).Select the DataReader. Set the Reader XML Path to
Autoto have DDS Blockset automatically generate a reader for the application.Select the Quality of Service (QoS). Set the Reader QoS to
Defaultto have the reader use the vendor provided QoS.
Configure the outports. The outports represent DataWriters in a DDS application.
Select the Topic. Set the Topic to the Circle Topic specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Circle).Select the DataWriter. Set the Writer XML Path to
Autoto have DDS Blockset automatically generate a writer for the application.Select the Quality of Service (QoS). Set the Writer QoS to
Defaultto have the writer use the vendor provided QoS.
Set up the build environment for your target vendor.
On the DDS tab, click Build.
Deploy the application executable on DDS.
Configure DataReaders and DataWriters by Using XML Definitions
This example uses the Shapes Demo example model to show how to configure the DataReaders and DataWriters for a DDS application by using definitions previously specified in imported XML definitions.
Open the Shapes Demo example model,
shapesdemo.openExample('shapesdemo');Create DDS definitions. In the DDS Application Quick Start, select Import from XML, and select the
shapesexample_qosXML file. When you close the Quick Start, the DDS DataReader and DataWriter definitions from theshapesexample_qosXML file become available in the DDS Dictionary for the example application.
Open the Code Mappings editor. On the DDS tab, click Code Interface and select Individual Element Code Mappings.

Configure the inports. The inports represent DataReaders in a DDS application. The Topic, DataReader, and QoS for each inport appears in the editor based on the imported XML definitions.
Verify the Topic. For the Topic, verify that the Square Topic specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Square) is shown in the editor.Verify the DataReader. For the Reader XML Path, verify that the DataReader,
MySquareRdr, specified by its path (myParticipant/MySubscriber/MySquareRdr), is shown in the editor.Configure the Quality of Service (QoS). Set the Reader QoS to
Defaultto have the reader use the vendor provided QoS.
Configure the outports. The outports represent DataWriters in a DDS application. The Topic, DataWriter, and QoS for each outport appears in the editor based on the imported XML definitions.
Verify the Topic. For the Topic, verify that the Circle Topic is specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Circle).Verify the DataWriter. For the Writer XML Path, verify that the DataWriter,
MyCircleWtr, specified by its path (myParticipant/MyPublisher/MyCircleWtr), is shown in the editor.Configure the Quality of Service (QoS). Set the Writer QoS to
Defaultto have the writer use the vendor provided QoS.
Set up the build environment for your target vendor.
On the DDS tab, click Build.
Deploy the application executable on DDS.
Related Examples
Properties
Version History
Introduced in R2021a