2016-02-05 75 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?

回答