how to read LAN data's in m-file
Ältere Kommentare anzeigen
hi,
I sent data from my pc to another pc, only the values sent shows the data. while i am reading in another pc, its not getting read. where sholud i do the mistake?
t=tcpip('192.168.1.4',80) // another pc name
bytesToRead=50;
t.BytesAvailableFcnMode='byte'
t.BytesAvailableFcnCount=bytesToread
fopen(t)
pause(3)
fwrite(t,1:255)
pause(3)
fclose(t)
now, in inspector element, i can see changes in valuesent=255 whereas, the same program only i did in another pc for reading
t=tcpip('192.168.1.4',80) // another pc name
bytesToRead=50;
t.BytesAvailableFcnMode='byte'
t.BytesAvailableFcnCount=bytesToread
fopen(t)
pause(3)
fread(t,255)
pause(3)
fclose(t)
instead of writing. but, there i am not able to see changes in inspector element.how should i do this?
Akzeptierte Antwort
Weitere Antworten (3)
Deepa Darshan
am 31 Jul. 2012
Bearbeitet: Walter Roberson
am 31 Jul. 2012
1 Stimme
1 Kommentar
Walter Roberson
am 31 Jul. 2012
The command tcpip() is not part of basic MATLAB: it is part of the Instrument Control Toolbox.
Your version of MATLAB has an Instrument Control Toolbox which is too old to support acting as a TCP server. To communicate between PCs, you need to do one of:
- switch to udp instead of tcp; or
- switch to the File Exchange contribution "tcpupdip"; or
- upgrade your MATLAB and Instrument Control Toolbox version
Deepa Darshan
am 30 Jul. 2012
Bearbeitet: Walter Roberson
am 30 Jul. 2012
1 Kommentar
Walter Roberson
am 30 Jul. 2012
R2010a cannot act as a TCP server when you use the Instrument Control Toolbox. It can receive UDP but not TCP.
The work-around is to use the MATLAB File Exchange contribution named "tcpudpip"
Deepa Darshan
am 4 Aug. 2012
0 Stimmen
Kategorien
Mehr zu Instrument Control Toolbox Supported Hardware finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!