# MatLab/Simulink Node-Red

**URL:** <https://discourse.nodered.org/t/matlab-simulink-node-red/46150>\
**Category:** General\
**Created:** [24 May 2021 11:57 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150 "2021-05-24T11:57:17Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [24 May 2021 11:57 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/1 "2021-05-24T11:57:17Z")

</div>

Hi, i came across on info (and clip), that NR and Matlab/simulink can exchange data via MQTT, UDP...

Is it any example?

I found this, but it is not English, so i don't understand much ([Sending data from simulink to node red then to tiaportal - YouTube](https://www.youtube.com/watch?v=FfV6jKsWS8s))

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 May 2021 13:31 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/2 "2021-05-24T13:31:48Z")

</div>

> [@Martin10](#):
>
> Matlab/simulink can exchange data via MQTT, UDP...
> 
> Is it any example?

There are 16 search results on the forum for "matlab" - none of those any good?

Regarding communicating to/from any device, MQTT is childs play.

[![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/9/197caa369e0c9258b7391fff82c5b690fb290360.jpeg "Simple Node-RED and MQTT Tutorial") ](https://www.youtube.com/watch?v=LXA-Ge3-ewo&t=125s)

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [24 May 2021 15:05 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/3 "2021-05-24T15:05:42Z")

</div>

Most of the topics do not have answers, i wish only to send sensor data.  
By the way, thanks for the video.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [25 May 2021 12:37 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/4 "2021-05-25T12:37:13Z")

</div>

Please, any help ?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 May 2021 12:43 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/5 "2021-05-25T12:43:27Z")

</div>

What have you tried ? I would start with something like a TCP in node set to listen to a port above 1024 - eg 3333 - connected to a debug node  
then set Matlab to write to that device (using 192.168.1.20 below but use your ip address) on that port - as per a write example [Write and Read Data over TCP/IP Interface - MATLAB & Simulink - MathWorks United Kingdom](https://uk.mathworks.com/help/matlab/import_export/write-and-read-data-over-the-tcpip-interface.html)

```auto
t = tcpclient("192.168.1.20",3333)
data = 1234;
write(t, data)

```

I don't have Matlab so can't test it - but assuming the manual is correct etc...

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [26 May 2021 09:40 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/6 "2021-05-26T09:40:26Z")

</div>

This is new for me, so i don't know even where to start

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [30 May 2021 13:02 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/7 "2021-05-30T13:02:39Z")

</div>

Any help, please ?

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [24 June 2021 12:44 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/8 "2021-06-24T12:44:44Z")

</div>

I wish to send sensor data via MQTT. Any help?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [24 June 2021 12:49 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/9 "2021-06-24T12:49:33Z")

</div>

Hi @Martin10

I can see a number of the previous results provided links for how to get started with MQTT. So it would be helpful if you could describe a bit more about what you have got so far and what you'd like to achieve.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [24 June 2021 13:25 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/10 "2021-06-24T13:25:42Z")

</div>

As I said, i am new in this, so i need some example for beginners. What I Wish to achieve is to send data to Simulink via Mqtt and than to make some data analyze.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [24 June 2021 14:56 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/11 "2021-06-24T14:56:05Z")

</div>

You need to start by understanding MQTT. This should help with that: [MQTT Essentials - All Core Concepts explained](https://www.hivemq.com/mqtt-essentials/)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 June 2021 15:30 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/12 "2021-06-24T15:30:07Z")

</div>

to send data from Matlab using MQTT is not a Node-RED problem - maybe try the Matlab help system ? - [MQTT in MATLAB - File Exchange - MATLAB Central](https://uk.mathworks.com/matlabcentral/fileexchange/64303-mqtt-in-matlab) - there seems to be a download and some docs there.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [24 June 2021 17:00 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/13 "2021-06-24T17:00:50Z")

</div>

Is there Simulink example instead of matlab?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 June 2021 17:35 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/14 "2021-06-24T17:35:50Z")

</div>

No idea - never used it... I think Google may be your best bet here.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 August 2021 17:35 UTC](https://discourse.nodered.org/t/matlab-simulink-node-red/46150/15 "2021-08-23T17:35:58Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
