8549 views|6 replies

693

Posts

7

Resources
The OP
 

MATLAB's UDP communication - How to send large batches of data packets via MATLAB's UDP [Copy link]

 
This post is from Innovation Lab

Latest reply

Hello, is there any corresponding code to share? Thank you very much 914897412@qq.com   Details Published on 2021-5-11 09:52
 
 

693

Posts

7

Resources
From 2
 

Found a solution. You need to set the input and output byte size in the code. The maximum size that can be sent is 65536 bytes.

set(u1, 'inputbuffersize', 65536);
set(u1, 'outputbuffersize', 65536);

This post is from Innovation Lab
 
 
 

693

Posts

7

Resources
From 3
 
str = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDddEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEeFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFf1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444445555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666688888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE';
%127.0.0.1即为本地
u1=udp('127.0.0.1','RemotePort',8847);
set(u1, 'inputbuffersize', 65536);
set(u1, 'outputbuffersize', 65536);%设置发送数据包的大小,可发送65536个字节的数据
fopen(u1);%打开udp连接

fprintf(u1,str);%向IP为127.0.0.1端口为8847发送数据
% fwrite(u1,str2);
%
%for i = 1:1:N;
%    fprintf(u2,TXT(i));
%end

fclose(u1);%关闭udp1连接

delete(u1);%删除udp1连接,释放内存

clear u1;%清除工作区中的udp1数据

This post is from Innovation Lab
 
 
 

693

Posts

7

Resources
4
 

Today I tried the fprintf function and the fwrite function respectively, and both have a length limit. Is there a good way to send 2000 bytes at a time?

This post is from Innovation Lab
 
 
 

693

Posts

7

Resources
5
 

Continue to post related questions: (3) How to decompose 4-byte integer data into 4 single-byte data in MATLAB

    FourBits_H_16 = fix(FourBits/65536); %%首先分解成高16位
    FourBits_L_16 = rem(FourBits,65536); %%分解成低16位
    i1 = fix(FourBits_H_16 /256);        %%高16位分解成高八位
    i2 = rem(FourBits_H_16 ,256);        %%高16位分解成低八位
    i3 = fix(FourBits_L_16/256);         %%低16位分解成高八位
    i4 = rem(FourBits_L_16,256);         %%低16位分解成低八位

This post is from Innovation Lab
 
 
 

693

Posts

7

Resources
6
 

Continue to post related questions (4) MATLAB UDP communication transmission rate test

Using MATLAB's UDP communication, 1000 packets of data are sent, each packet has 2000 bytes, and the time taken to complete the sending is 0.447841 seconds, that is, 2000 bytes are sent every 0.44781 milliseconds, which is 4466180 bytes per second, or 4466180/8Byte per second, or 4466180/8/1024 KB/s.

This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
7
 
bqgup posted on 2021-4-29 11:13 Continue to post related questions (4) MATLAB's UDP communication transmission rate test Use MATLAB's UDP communication to send 1000 packets of data, each packet has...

Hello, is there any corresponding code to share? Thank you very much 914897412@qq.com

This post is from Innovation Lab
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list