Chapter 4 Programming Demos RIGOL
DP800 Programming Guide 4-7
Matlab Programming Demo
The program used in this demo: MATLAB R2009a
The function realized in this demo: read the output voltage, current and power measured internally on
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:\DP800_Demo.
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:
dp800 = visa( 'ni','USB0::0x1AB1::0x0E11::DP8A000001::INSTR' ); %Create VISA object
fopen( dp800 ); %Open the VISA object created
fprintf(dp800, ':MEAS:ALL? CH1' ); %Send request
meas_CH1 = fscanf(dp800); %Read data
fclose(dp800); %Close the VISA object
display(meas_CH1) %Display the device information read
4 Save the M file under the current directory. In this demo, the M file is named as
DP800_Demo_MATLAB.m.
5 Run the M file and the following running result is displayed in the command window.
meas_CH1 =
7.9833,0.0484,0.386