Lesson 1. Creating a "Hello World" User Operator Script

Instrument
DCA-X
N109x
UXR Scope
Flex Apps:
FlexDCA
FlexRT
MATLAB

In this lesson, you'll learn how to create the simplest operator possible to prove your FlexDCA / MATLAB environment. After you finish this lesson, continue with Lesson 2.

Procedure

  1. Make sure that you have fullfilled the basic requirements for MATLAB.
  2. Copy the following XML listing into a text editor. Name the file HelloWorld.xml and save it in FlexDCA's user functions folder (\Documents\Keysight\FlexDCA\User Functions).
  3. HelloWorld.xml
    Drag the mouse over this listing, enter Ctrl-C to copy, and paste it into your text editor!
    • <?xml version="1.0" encoding="utf-8"?>
    • <Function xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    • <Script>HelloWorld.m</Script>
    • <Name>Hello World!</Name>
    • <!-- <Icon>MyPicture.png</Icon> -->
    • <FunctionType>1 Source</FunctionType>
    • </Function>
    The <Icon> element is optional. This element allows you to place a picture on your user operator icon.
    Example without <Icon> element
    Example with <Icon> element
  4. Copy the following script into MATLAB's editor. Save your script file in FlexDCA's user operator folder (\Documents\Keysight\FlexDCA\User Functions) and name it HelloWorld.m.
  5. HelloWorld.m
    Drag the mouse over this listing, enter Ctrl-C to copy, and paste it into the MATLAB editor!
    Gain = 2.0; % change the gain of the output signal
    FiltData = SrcData; % assign input waveform to output waveform
    

    Do not use spaces or hyphens when selecting a filename for your script.

    Enter the above script exactly as written. Otherwise, the script will fail.

  6. Place FlexDCA into Oscilloscope or Eye/Mask modes and display a waveform on the display.
  7. On FlexDCA's menu, click Measure > Waveform Signal Processing (Math).
  8. At the top of the Waveform Signal Processing dialog, select the User tab and drag a single-input User operator icon into the operator construction area as shown in the following picture.
  9. Click on the user operator to open the User Operator Setup dialog.
  10. In the dialog, click Browse and select your XML configuration file, HelloWorld.xml.
  11. In the Waveform Signal Processing dialog, drag a Function Color to the User Operator as shown in the following picture. This will display the output waveform of the function.
  12. Click Autoscale and the input and output waveforms should be displayed. Of course, your waveforms will be different from those shown here. The important thing is that both the input and output waveforms are displayed. Notice that the Signals legend identifies the operator's output waveform.
  13. You may have to wait a few seconds for the waveform to appear and the waring icon () to be removed.