MATLAB: How to use Matlab TCPIP from the instrument control box to read data from a RS232 device server? (solved)

instrument control boxInstrument Control Toolboxlantronixrs232tcpiptelnet

I'm not very experienced with TCPIP, so sorry if I am asking some stupid questions.
I have RS232 devices: e.g.: balances and other measurement instruments. The devices are connected to a RS232 device server (Lantronix). Using telnet (windows or any other client), communication works just fine, so the device server and the instruments are configured correctly e.g.: "telnet [IP Adress] [Port number]" from the command line "&e" command + Enter -> the measurement device sends back the measured values e.g: "4.162899383e-002 9.946371737e-001 :E,8F"
Using Matlab TCPIP from the instrument control box I tried the following code:
t=tcpip('P Adress',Port number)
set(t, 'InputBufferSize', 30000);
fopen(t)
fwrite(t,'&e')
while (get(t, 'BytesAvailable') > 0)
t.BytesAvailable
DataReceived = fscanf(t)
end
I dont get any error messages, but I also dont get any read back from the measurement device. There is nothing in the Input Buffer. The RS232 device server also does not register any bytes sent from the device, only those sent to the device. This might be some character set issue, since the command "&e" results in 4 bytes sent to the device and the matlab TCPIP only results in 2 bytes sent. Or maybe there is some other fundamental problem.
Does anyone have experience with this kind of issues and can help?

Best Answer

In found the answer, it was merely a syntax problem (/r,/n were missing).
Related Question