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!
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!