Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCP/IP/UDP Toolbox

Status
Not open for further replies.

brfe

Electrical
Apr 17, 2008
5
DE
I have a system that consists of a PLC that it is gonna send MATLAB some string messages and I have my MATLAB Application that is responsible to be the interface of a machine.

Using this toolbox I can already establish a connection between MATLAB and my PLC, but I cannot read the messages sent from the PLC to my MATLAB Application.

I've established the connection with the function:

sockcon=pnet('tcpsocket',8000);
pnet(sockcon,'tcplisten');

because in this case my PLC is the client and MATLAB the server and I'm using the port 8000.

My question is: what do I have to do to read the string sent from my PLC to MATLAB. I've already tried the functions:

data=pnet(con,'readline',1024);

data=pnet(sockcon,'read' ,['200'], ['char'], ['network'], ['view'],'noblock');

pnet_remote(con,'serverat');

but non of these three worked out.

Does anybody can help me?
Thanks a lot!
 
Replies continue below

Recommended for you

Already found the solution. Thanks
 
Hi,
i have a problem like you. I want to cominicate with matla/simulink and a robot kuka via tcpip.i have some question about your solution...where do you find the pnet command? In the robot there is a visual basic program who send a string and receive a string...do you think it is possible to read and send data with matlab to the robot?
 
Hi,

I am using the tcp_udp_ip toolbox with matlab 2007b. I can't seem to get data I know is being sent to read into matlab.

I have a program that is sending udp data on a certain port ( I know this because it comes with a command line reader that can read it) but when I setup the pnet command, I get a whole lot of nothing.

BRFE, what was your solution? Anyone else?

B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top