AnsweredAssumed Answered

PNA 5247A remote data transfer with matlab

Question asked by lzuxz on Feb 6, 2013
Latest reply on Feb 7, 2013 by lzuxz
I used to get data with matlab from pna 5247A by using visa and binblockread.
However, we now have no pc environment, and only a apple laptop could be used,we could only use the tcpip and fread in OS.
The code is following:

VNA=tcpip(''*.*.*.*',5025);
set(VNA, 'InputBufferSize', 30000);  
set(VNA, 'Timeout', 150);    

fopen(VNA)
fprintf(VNA, 'CALC:PAR:SEL "CH1_S11_1"');

fprintf(VNA, 'FORM:BORD SWAP');
% Set data type to real 32 bit binary block
fprintf(VNA, 'FORM REAL,32');

fprintf(VNA, 'CALC:DATA:S2P  2');

% data1=scanstr(VNA);

% fwrite(VNA, 'OUTPDATA'); 

%Read out #A from binblock
temp=fread(VNA, 2, 'char') 

%Read out block size
temp=fread(VNA, 1, 'uint16') 

%Read out trace data
data1=fread(VNA, temp/4, 'float32');

'fread' could read back the #A and the blocak size, sometimes, although it need a very long time. However,It could not read back the trace data.

Which command should I use to get the data back quickly.

Edited by: lzuxz on Feb 7, 2013 7:41 AM  

Outcomes