Sending data to UDP Receive Block Simulink

조회 수: 2 (최근 30일)
m8freckles
m8freckles 2017년 3월 21일
답변: m8freckles 2017년 3월 31일
Hey! I need to send data (two rotation matrix) through UDP port. The size of my data is a 3x6 matrix and i'm using this code to send it to a UDP Receive Block on Simulink:
host='192.168.135.240';
port='3333';
echoudp('on',3333);
u=udp(host,3333);
fopen(u);
a=rand(3,3);
b=ones(3,3);
data=[a b];
fwrite(u,data(:),'double');
fclose(u);
delete(u);
clear('u');
echoudp('off');
I do receive the data on my UDP receive block and display them in the simulink model, but my problem is that i need to run three times the mfile before the data are shown on the display. The block parameters in the simulink model are shown in figure.
Have you any idea how to solve this problem? Thank you!

채택된 답변

Mahesh Pai
Mahesh Pai 2017년 3월 29일
편집: Mahesh Pai 2017년 3월 29일
It is my understanding that you need to send a UDP packet multiple times for successfully receiving it on the other machine. The configuration you have mentioned above looks correct. The below document mentions some troubleshooting steps for the UDP interface in MATLAB:
The troubleshooting document also mentions that UDP is not a reliable protocol and packets can be dropped. You may need to try sending or receiving multiple times.

추가 답변 (1개)

m8freckles
m8freckles 2017년 3월 31일
Ok,thank you for your help!

카테고리

Help CenterFile Exchange에서 Development Computer Setup에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by