# 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 Infiniium / MATLAB environment. After you finish this lesson, continue with Lesson 2.

## Procedure

1. Make sure that you have fulfilled the basic requirements for MATLAB.
2. Copy the following XML listing into a text editor. Name the file HelloWorld.xml and save it in Infiniium's user functions folder (\Documents\Keysight\Infiniium\User Functions).

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

3. Copy the following script into MATLAB's editor. Save your script file in Infiniium's user operator folder (\Documents\Keysight\Infiniium\User Functions) and name it HelloWorld.m.

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.

4. Display a waveform on the display.
5. Click the button on the lower-right corner of the screen.
6. At the top of the Functions dialog box, select the User tab and drag a single-input User operator icon into the operator construction area as shown in the following picture.
7. Click on the user operator to open the User Operator Setup dialog box.
8. In the dialog box, click Browse and select your XML configuration file, HelloWorld.xml.
9. In the Functions dialog box, drag a Function Color to the User Operator as shown in the following picture. This will display the output waveform of the function.
10. 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.

You may have to wait a few seconds for the waveform to appear and the warning icon () to be removed.