Matlab programming demo, Matlab programming demo -6 – RIGOL DG1000Z Series User Manual
Page 232

RIGOL
4-6
DG1000Z Programming Guide
Matlab Programming Demo
The program used in this demo: MATLAB R2009a
The function realized in this demo: query the current waveform type as well as the waveform
frequency, amplitude, offset and phase of CH1.
1. Run the Matlab software and modify the current directory (namely modify the Current Directory at the
top of the software). In this demo, the current directory is modified to E:\DG1000Z_Demo_Matlab.
2. Click File New Blank M-File in the Matlab interface to create an empty M file.
3. Add the following codes in the M file:
dg1000z = visa(
'ni'
,
'USB0::0x1AB1::0x0642::DG1ZA000000001::INSTR'
);
%Create VISA object
fopen(dg1000z);
%Open the VISA object created
fprintf(dg1000z, ':SOURce1:APPLy?' );
%Send request
query_CH1 = fscanf(dg1000z);
%Query data
fclose(dg1000z);
%Close the VISA object
display(query_CH1)
%Display the device information read
4. Save the M file under the current directory. In this demo, the M file is named as
DG1000Z_Demo_MATLAB.m.
5. Run the M file. The following running result is displayed in the command window.