Lesson 1. Creating a "Hello World" User Operator Script
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
- Make sure that you have fullfilled the basic requirements for MATLAB.
- 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).
- <?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>
- 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.
- Place FlexDCA into Oscilloscope or Eye/Mask modes and display a waveform on the display.
- On FlexDCA's menu, click Measure > Waveform Signal Processing (Math).
- 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.
- Click on the user operator to open the User Operator Setup dialog.
- In the dialog, click Browse and select your XML configuration file, HelloWorld.xml.
- 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.
- 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.
|
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 |
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.
You may have to wait a few seconds for the waveform to appear and the waring icon () to be removed.