Configure LabVIEW as Server and Simulink as ClientConfigure LabVIEW:
To configure LabVIEW to act as a Server, you need to create a VI. You can create a simple VI using the steps in
Basic TCP/IP Communication in LabVIEW or refer to the
Simple TCP.lvproj in the
labview\examples\Data Communication\Protocols\TCP\Simple TCP directory for an example of using the TCP VI and functions. Here you can find
Simple TCP - Server.vi. Configure the port number for TCP/IP communication.

Configure Simulink:
Step 1: Create a New Model
- On the Simulink start page, click Blank Model>>Create Model. An empty Editor window opens.
- In the toolstrip, click Save to assign a name to your new model.
Step 2: Open the Block Library
- In the toolstrip, click Library Browser in the Simulation tab.
- The Simulink Library Browser opens. The left pane contains a tree of available block libraries in alphabetical order. Click Instrument Control Toolbox.
- To use a block, add it to an existing model or create a new model.

Step 3: Drag the Instrument Control Toolbox Blocks into the Model
- To use a block in a model, drag the block into the Simulink Editor. For this model, you need one instance of the TCP/IP Receive block in your model.
- Make the connection between the output port of the TCP/IP Receive block and the input port of the Scope block.

Step 4: Specify the Block Parameter Values
- Double-click the Receive block to open its parameters dialog box.
- Set the Remote address to localhost and fill the Port field. The port number in Simulink must be the same as configured in LabVIEW.
- Click OK.
View the Results:
After configuration steps, run the LabVIEW Server vi and after that run Simulink Client simulation. The number sent via LabVIEW will be visible in Simulink as well.
Configure Simulink as Server and LabVIEW as ClientConfigure Simulink:
Step 1: Install Simulink Desktop Real-Time Kernel
The
Simulink Desktop Real-Time Kernel needs to be installed in Simulink. To do that go to Matlab Workplace and in the Command Window type
sldrtkernel -setup
After the successful installation, there is a need to restart the PC.
Step 2: using the Simulink Stream Output block
The Simulink
Stream Output function is located in
Simulink Library Browser>>Simulink Desktop Real-Time - 1 section.

In the Block Parameters section, there is a need to create a new board by clicking on the
Install new board button.

In the opened drop-down menu go to
Standard Devices>>TCP Protocol
In the opened window there is a need to configure the
Connection mode: Server, select the
Local TCP port: (the one there is a need to use), the
Remote TCP port: (can be any port), and the
Remote host name or IP address: localhost.
In the Block Parameters section, the Format string: represents the
data type to transfer. In this case, it is
'%g' meaning the representation of numeric value is Integer. If there is a need to transfer a double value, you should use
'%f'.
Configure LabVIEW:
In LabVIEW a simple VI needs to be created as a TCP client. You can create a simple VI using the steps in
Basic TCP/IP Communication in LabVIEW or refer to the
Simple TCP.lvproj in the
labview\examples\Data Communication\Protocols\TCP\Simple TCP directory for an example of using the TCP VI and functions. Here you can find
Simple TCP - Client.vi. Configure the port number for TCP/IP communication.

The
bytes to read value should represent the digits of the numeric data. As LabVIEW receives the data in string values, it represents each digit as one byte, so if you are sending a two-digit value, you should read it in two bytes.
View the results:
When starting the transfer of the data, you should run the Simulink model first and then the LabVIEW VI.