# Accessing Variables in MATLAB User-Operator Scripts

## Input Variables

When Infiniium starts a user-operator script, the following variables are placed in the MATLAB workspace:

- Any variables that you defined with the <Variable> XML element.
- Any user-defined control variables that you defined with the <Integer>, <Double>, <Enumeration>, <String>, or <File> XML elements.
- The variables listed in the following table.

Each input variable, except for SoftwareVersion, listed in the following table has four forms. The one listed is for a single input waveform or the first waveform in a multiple-input waveform function. If second, third, or fourth input waveforms exist, their variables have "2", "3", or "4" appended. For example, the SrcData2 variable is used for the second waveform, the SrcData3 variable for the third waveform, and the SrcData4 variable is used for the fourth waveform.

Input Variables
Variables | Description
--- | ---
SrcData | The input waveform. Values are in volts for electrical signals and Watts for optical signals.
SrcDataFile | When file-base I/O is used (see File-Based I/O in MATLAB), this variable is used instead of the SrcData variable.
Source | The source of the input waveform. Example: Source = 'Channel 2'
XOrg | The time of the first x-axis value of the input waveform value of SrcData. Example: XOrg = 8.785e-11
XInc | The spacing of the x-axis input waveform values of SrcData. Example: XInc = 2.232e-13
XUnits | The X units associated with the input waveform. Refer to Valid Measurement Units. Example: XUnits = 'Second'
YUnits | The Y units associated with the input waveform. Refer to Valid Measurement Units. Example: YUnits = 'Volt'
SymbolRate | The current value of the 'Symbol Rate' control. Example: SymbolRate = 9953280000.0
SrcClipped | Set to True if the source data was clipped high or low; otherwise set to False. Example: SrcClipped = True
ClipHigh | The maximum value that could be present in the source waveform. If SrcClipped is True, check to see which elements of SrcData are equal to ClipHigh to determine which elements were clipped. Example: ClipHigh = 0.51057
ClipLow | The minimum value that could be present in the source waveform. If SrcClipped is True, check to see which elements of SrcData are equal to ClipLow to determine which elements were clipped. Example: ClipLow = -0.510869
IsAvgComplete | Flag tells if waveform averaging is complete. Set to True if complete, otherwise False if not complete. Example: IsAvgComplete = True
AvgAcqCount | The current value of the 'Number of Averages' control in the Averaging tab of the Acquisition dialog if averaging is enabled, otherwise its value is 1. Example: AvgAcqCount = 1
SourceBw | The bandwidth of the input source. Example: SourceBw = 150000000000.0
SignalType | The signal type of the input source (for example, Unspecified, NRZ, PAM4, etc.). Example: SignalType = 'NRZ'
YMiddle | The Y middle of the display of the input source.
YDispRange | The Y range of the display of the input source.
SoftwareVersion | The Infiniium software version that is being run.
Markers | Marker information if markers are on source waveform. If a marker is not on, it is not available. Example: x = Markers(1).Position
    Markers = [struct('Name','X1','Source','Channel 1','Position',5.9853e-10,'Status','Correct')...
    struct('Name','X2','Source','Channel 1','Position',6.4853e-10,'Status','Correct')...
    struct('Name','X3','Source','Channel 1','Position',8.0353e-10,'Status','Correct')...
    struct('Name','X4','Source','Channel 1','Position',8.5603e-10,'Status','Correct')]

## Output Variables

This topic lists the variables whose values are returned to Infiniium when your script completes. The top three variables listed in the table must be set in your script. The remaining variables may be used, if needed.

Output Variables
Variable | Description | Returned
--- | --- | ---
Required | Optional
FiltData | Output waveform. | ♦ |
FiltDataFile | When file-base I/O is used (see File-Based I/O in MATLAB), this variable is used instead of the FiltData variable. | ♦ |
XOrg | The time of the first x-axis value of FiltData. | ♦ |
XInc | The spacing of the x-axis values of FiltData. | ♦ |
Gain | Signal gain of operators that have one input. |  | ♦
FilterWidth | Filter width. |  | ♦
FilterDelay | Filter delay. |  | ♦
XUnits | The X units associated with the output waveform's x-axis. Refer to Valid Measurement Units. |  | ♦
YUnits | The Y units associated with the output waveform's y-axis. Refer to Valid Measurement Units. |  | ♦
ErrorMsg | Any generated Infiniium error message. |  | ♦