2016-02-05 73 views
0

我想实时从python传输数据到matlab使用UDP协议(因为这篇文章建议:Real-time data transfer from Python to MATLAB)。从python建立连接到matlab

现在这就是我,这dosent工作:对蟒蛇

(发件人):

import socket 

my_socket= socket.socket() 
my_socket.connect(('127.0.0.1', 8821)) 

MESSAGE='test1' 
for i in range(1,10): 
    my_socket.send(MESSAGE) 
    print i 

my_socket.close 
MATLAB的

(reciver):

u = udp('0.0.0.0','LocalPort',8821); 
fopen(u); 

while(1) 
    A = fread(u,10); 
end 

fclose(u) 

它dosent工作,以及我得到的错误: from python: enter image description here

和matlab:

Warning: Unsuccessful read: The specified amount of data 
was not returned within the Timeout period. 

任何idieas?

回答