AnsweredAssumed Answered

How to transfer data from VNA to PC using Matlab (TCP/IP connection)

Question asked by botos on Mar 31, 2015
Latest reply on Apr 4, 2015 by bhokkan
*I want measure S-parameter (S11 only) using VNA (N9918A FieldFox Handheld Microwave Combination Analyzer) and want transfer the data to PC using matlab.* 

*I established the connection through LAN cable. but when I run this code in Matlab it gives me this warning:*
*Warning: Unsuccessful read: VISA: A timeout occurred*


*the code:*
  
clc; clear;
numPoints=201; %set the number of points
fi=1e9; %Starting frequency
fe=4e9;   %Ending frequency
VNA_adress = 'TCPIP0::192.168.1.2::inst0::INSTR'; %VNA adrress
 
VNA_obj = visa('agilent',VNA_adress);  %connect the VNA 
 
set(VNA_obj,'InputBufferSize',2000,'ByteOrder','littleEndian','Timeout',10); % set object Parameters
fopen(VNA_obj); % open object
 
% Send Instructions to the VNA to take reading measurement
fprintf(VNA_obj,['STAR ' num2str(fi*1e-9) ' GHz; STOP ' num2str(fe*1e-9) ' GHz;']);
fprintf(VNA_obj,['CHAN1; S11; POIN' num2str(numPoints) ';']);
fprintf(VNA_obj,'SING;');
fprintf(VNA_obj,'LOGM;');
fprintf(VNA_obj,'CONT;');
 
% getting Data from the VNA
trans_data= fscanf(VNA_obj); % read formatted data from the file
data= strread(trans_data,'%f','delimiter',','); % read formatted data from the string
Re_data= data(1:2:end); % real data
Im_data= data(2:2:end); % imaginary data
 
fclose(VNA_obj); % close the object
delete(VNA_obj); % delete the object


*I tried different codes but the same problem happen. Also, I tried to increase the timeout .* 

*Please Help*  

Outcomes