Matlab receive data with udpport

조회 수: 3 (최근 30일)
Mark S
Mark S 2022년 4월 17일
답변: Dinesh 2023년 9월 27일
Hello, I am trying to use udpport for receiving data with matlab. Therefore I want to test it.
Can I test it if my code works? I mean if I can use another program to send some data and test it if I receive this data with matlab? I have used the program Hercules. But that did not work.
So my question:
-Is it possible to send some data with Hercules to matlab udpport?
-Are my settings right?
%% clean up
clear all
close all
clc
u = udpport("LocalHost","127.0.0.1","LocalPort",59152);
configureTerminator(u,"CR/LF");
data = readline(u);
A = sscanf(data,'%f');

답변 (1개)

Dinesh
Dinesh 2023년 9월 27일
Hi Mark,
I understand that you want to test if your udp port is receiving data or not. For this you can simply use two MATLAB sessions to test whether the udp port is receiving data or not.
For an example regarding the udp communication please refer to the following MATLAB documentation.
For the second question your code is fine and works perfectly.
Hope this helps.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by