User manual

Table Of Contents
MAUI Oscilloscopes Remote Control and Automation Manual
Copying Waveform Data to Excel
This Excel macro reads the number of samples in a waveform and places it in cell B1 of the spreadsheet,
then reads all waveform sample values and copies them into column A (A1...Axx). The example is coded in
VBA, and would be launched by a button in a spreadsheet.
Sub Button1_Click()
' Connect to the oscilloscope
Set app = CreateObject("LeCroy.XStreamDSO")
' Query the number of samples in C1 and store in cell "B1"
numSamples = app.Acquisition.C1.Out.Result.Samples
Cells(1, 2)
Value = numSamples
' Access waveform data array, fill first column of the spreadsheet
wave = app.Acquisition.C1.Out.Result.DataArray
For i = 0 To numSamples - 1
Cells(i + 1, 1).Value = wave(i)
Next i
End Sub
Note: Ensure that the record length is < 64 k samples, since Excel has a limit on the number of rows
in a spreadsheet. Ideally, start experimenting with short (500 point) records.
Storing Waveform Data in a Text File
This VBScript example is very similar to the VBA macro example above, the most notable difference being
the use of a standard system ActiveX control, Scripting.FileSystemObject, to enable the creation of files
containing waveform data in ASCII format.
' Connect to the oscilloscope
Set app = CreateObject("LeCroy.XStreamDSO")
' Code to take acquisition and generate FFT in F1
. . .
' Readout the FFT
numSamples = app.Math.F1.Out.Result.Samples
' Write the FFT power spectrum into the file, sample by sample
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("c:\XStreamFFT.txt", True)
wave = app.Math.F1.Out.Result.DataArray
For i = 0 To numSamples - 1
MyFile.WriteLine(wave(i))
Next
' Clean up
MyFile.Close
Set fso = Nothing
Set app = Nothing
2-32