How to speed up UDP connections?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have to different versions of Matlab (6.5 and 7.11) communicating with each other. I use UDP as protocol. But it's very slow. Just to test the whole communication thing, I created to Simulations. Sim1 adds 5 to the incoming value, Sim2 subtracts 3. So Sim1 gets an initial value (in this case 1), calculates, gives the result to Sim2, where the same thing happens and so on. I want to calculate for 100 steps and it takes about 15s! Which is too long, cause in the real simulation I have ~400000 steps. How can I optimize the whole thing? Any ideas?
remotehost = '127.0.0.1';
remoteport = 10000;
u = udp(remotehost,remoteport,'LocalPort',10001);
fopen(u);
sample_time=0.1;
A=[1 1];
for sample=1:100
if isempty(A)
A=fread(u,2,'double');
end
num_ele=length(A);
for i=1:num_ele/2
udp_in(i,1)=A(2*i-1);
udp_in(i,2)=A(2*i);
end
sim('sim1',sample*sample_time)
A=[];
l2r=[sample*sample_time,udp_out(1)];
fwrite(u,l2r,'double')
end
fclose(u);
delete(u);
clear u;
5 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Beamforming and Direction of Arrival Estimation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!