Binary Oscilloscope File to MATLAB Translator Program
This program lets you import data from your Keysight oscilloscope into The MathWorks MATLAB^{®}. MATLAB is a
You can save data from Keysight oscilloscopes such as the 6000 Series, 8000 Series, and 80000 Series in Keysight oscilloscope binary format. You can use the program importKeysightBin.m in MATLAB to read the oscilloscope's binary output file in MATLAB.
General Instructions
Place the translator program importKeysightBin and the binary file from the oscilloscope in the MATLAB work directory. Then call the translator function from MATLAB. One of the arguments of the function is the binary file from the oscilloscope (enclosed in single quotes and parenthesis). The output of the function is the x and y axis arrays.
Examples
Example 1: List 10 Points
The file points10.bin is a file consisting of ten points on the rising edge of a waveform saved on a Keysight DSO81204B oscilloscope. The samples were taken at 40 GSa/s (25 ps/point).
 Copy the binary data file points10.bin and the program importKeysightBin.m to the work directory of your MATLAB program.

Call the function
importKeysightBin('points10.bin')
(with the quotation marks and parenthesis) from within MATLAB.  For reference, see the sample MATLAB program (plot10points.m) which is included in the zip file.
Example 2: Plot Square Wave
This example plots several cycles of a square wave. The binary file myFileName.bin is 1000 points.
 Save the myFileName.bin file and the importKeysightBin.m file to the MATLAB work directory.
 (with the quotation marks and parenthesis) from within MATLAB.
 For reference, see the sample MATLAB program (plot1024points.m) which is included in the zip file.
Documentation
Introduction
Many engineers would like to import data from their oscilloscope into MATLAB. The process described below is a method of converting binary data files from a Keysight Infiniium Oscilloscope to MATLAB compatible arrays.
 Save the data in binary format on the hard drive of the oscilloscope.
 Transfer the binary scope data into the MATLAB work directory on a PC.
 Call the importKeysightBin function from MATLAB.
The binary format used by MATLAB is not the same as the binary format used by the Keysight oscilloscopes. Therefore a translation program must be used. This translation program is a function. Therefore, the MATLAB engineer calls this function from the MATLAB applications program.
This program is a MATLAB Mfile which has a .m file extension. To be more precise it is a MATLAB function. The program is a text file written in the MATLAB language. The function name is importKeysightBin and the name of the .m text file is importKeysightBin.m.
The translator program and the original binary file from the oscilloscope should be placed in the MATLAB work directory. Then you call the translator function from the MATLAB.m program. One of the arguments of the function is the binary file from the oscilloscope enclosed in single quotes. The output of the function is the x and y axis arrays.
The importKeysightBin Function
The input file is created on the oscilloscope by saving the waveform trace in Keysight oscilloscope binary format. The input file name is enclosed in single quotes inside the function call (because it is a text string).
Varagin is set to 1 or omitted for the translation of a single y axis voltage vector.
Output Variables
The output of the function is two single dimension arrays (vectors):
timeVector which is the x axis set of time sample points.
timeVoltage which is the y axis set of voltage measurement points.
Translator Theory of Operation
The first line in the .m file is the function definition line. The outputs are in square brackets and the inputs are in parenthesis.
The next five lines are documentation lines. They begin with a % sign.
First, the file header information is read. ( Keysight binary files contain an extensive file header that is documented in the oscilloscope’s online help system.) This begins with initializing the fileid (fid) using the fopen function. The fopen function initializes fid to a MATLAB scalar integer used to identify the file in subsequent file function commands. Filesize is a scalar integer indicating the size of the file. nWaveforms is a scalar integer indicating the number of waveforms.
Next, the nPoints variable is read along with the x and y unit information. The time vector is calculated from xincrement and xorigin.
Finally the voltage vector is read.
Documents & Downloads
Oscilloscope Binary File to MATLAB Examples
This is a zip file containing programming examples for converting Keysight oscilloscope binary files to MATLAB binary files.
Programming Example 20070510 
ZIP
6 KB
