# MATLAB Measurements Variables

When Infiniium starts a user-measurement script, the variables listed in the following table are placed in the MATLAB workspace. This includes any variables that you defined with the <Variable> XML element.

## Input Variables

Each input variables, except MeasurementData and SoftwareVersion, listed in the following table has two forms. The one listed is for a single input waveform or the waveform 1 of a dual-waveform input measurement. If a second input waveform exists, its variable has the digit "2" appended. For example, SrcData becomes SrcData2 for the second waveform.

Input Variables
Variables | Description | Data types
--- | --- | ---
Wave | Eye
SrcData | The input waveform where the waveform consists of y-data values. Values are in volts for electrical signals and Watts for optical signals. | ♦ |
The input data for an eye diagram is a database where the waveform consists of hits-per-pixel arranged in a two-dimensional array ([column][row]). The column index represents increasing time values starting from the waveform's displayed left side to its right side. The row index represents increasing amplitude values that are in volts for electrical signals and Watts for optical signals. |  | ♦
Source | The source of the input waveform. Example: Source = 'Channel 2' | ♦ | ♦
SourceBw | The bandwidth of the input source. Example: SourceBw = 150000000000.0 | ♦ | ♦
TotalHits | The number of hits in eye database. Example: TotalHits = 2809395 |  | ♦
NumCols | The number of columns in eye database. |  | ♦
NumRows | The number of rows in eye database. |  | ♦
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' | ♦ | ♦
YOrg | The time of the first y-axis value of SrcData. Example: YOrg = -0.42711 |  | ♦
YInc | The spacing of the y-axis values of SrcData. Example: YInc = 0.0016430 |  | ♦
YUnits | The Y units associated with the input waveform. Refer to Valid Measurement Units. Example: YUnits = 'Volt' | ♦ | ♦
BitRate | The current value of the 'Data Rate' control. Example: BitRate = 9953280000.0 | ♦ | ♦
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 | ♦ |
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')]
MeasurementData | A structure for each defined dependent measurement. Up to four dependent measurements can be defined. | ♦ | ♦
Example: x = MeasurementData(1).Result
    MeasurementData = [struct('Name','Amplitude','Result',0.5032,'Status','Correct','Units','Volt','Source1','Channel 1','Source2','')...
    struct('Name','Peak-Peak','Result',0.5096,'Status','Correct','Units','Volt','Source1','Channel 1','Source2','')]
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. | ♦ | ♦

## Output Variables

This topic lists the variables whose values are returned to Infiniium when your script completes. The Result variable must be set in your script. The remaining variables may be returned, if needed.

Output Variables
Variable | Type | Description
--- | --- | ---
Variables that must be returned by your script
Result | float | The measured scalar result.
Optional variables that can be returned by your script
Units | string | Returns the measurement units of the result. Refer to Valid Measurement Units.
Status | string | Returns the status of the measurement result. The string can be 'Correct', 'Questionable', or 'Invalid'.
ErrorMsg | string | Returns an error message for the measurement. The error message is displayed in the oscilloscope message area.