242 Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide
Creating and Downloading Waveform Files
Downloading Waveform Data
1. Open a connection session with the signal generator.
The following code establishes a LAN connection with the signal generator,
sends the IEEE SCPI command *idn?, and if the connection fails, displays an
error message.
2. Download the I/Q data
The following code downloads the generated waveform data to the signal
generator, and if the download fails, displays a message.
Line Code—Open a Connection Session
1
2
3
4
5
io = agt_newconnection('tcpip','IP address');
%io = agt_newconnection('gpib',<primary address>,<secondary
address>);
[status,status_description,query_result] = agt_query(io,'*idn?');
if status == -1
display ‘fail to connect to the signal generator’;
end;
Line Code Description—Open a Connection Session with the Signal Generator
1 Sets up a structure (indicated above by io) used by subsequent function calls to establish a LAN connection to
the signal generator.
— agt_newconnection() is the function of Keysight Waveform Download Assistant used in
MATLAB to build a connection to the signal generator.
— If you are using GPIB to connect to the signal generator, provide the board, primary
address, and secondary address: io = agt_newconnection('gpib',0,19);
Change the GPIB address based on your instrument setting.
2 Send a query to the signal generator to verify the connection.
— agt_query() is an Keysight Waveform Download Assistant function that sends a query to
the signal generator.
— If signal generator receives the query *idn?, status returns zero and query_result returns
the signal generator’s model number, serial number, and firmware version.
3–5 If the query fails, display a message.
Line Code—Download the I/Q data
6
7
8
9
[status, status_description] = agt_waveformload(io, IQwave,
'waveformfile1', 2000, 'no_play','norm_scale');
if status == -1
display ‘fail to download to the signal generator’;
end;