# MATLAB Measurements Applications

A simple XML configuration file identifies your measurement script. In addition to calling the script, the XML file populates the User Measurement Setup dialog box.

MATLAB Applications are created using the MATLAB Compiler. The resulting *.exe file can be run without having MATLAB installed on the oscilloscope or PC. However, the MATLAB Compiler Runtime (MCR) must be installed on the oscilloscope or PC where Infiniium is installed. The MCR version must match the MATLAB version that was used to compile the MATLAB application.

In general, variables in the MATLAB application workspace are not cleared after the application runs. As a result, user variables declared in scripts may contain stagnant values from a previous run. To avoid issues caused by stagnant values, initialize script variables before using them or clear them at the end of the script.

When a user measurement is run, Infiniium performs the following tasks for each data acquisition:

1. Pushes standard variables and custom variables into the MATLAB workspace, including the source waveform. The script must by named algorithm.m and have a algorithm function as described in Lesson 3.
2. Runs any selected "dependent" Infiniium measurements in which the measurement result is used by the script. (specified in XML file).
3. Executes the script.
4. Retrieves the measurement result from the MATLAB workspace and displays the result in the measurement results table. A number of standard output variables are also retrieved from the MATLAB workspace.