Equation Editor and MATLAB®


MATLAB can be used with Equation Editor in two different ways:

1.  When you install a full version of MATLAB on the VNA, MATLAB functions can be called directly from Equation Editor.

  1. Install the full 32 bit version of MATLAB.

  2. Press Math > Analysis > Equation Editor....

  3. In the Equation Editor dialog, click the Enable MATLAB button.

  4. You can then start calling MATLAB from within your equation editor entry field.

  5. Here are a few example of how you would do this:

2.  Compile a MATLAB *.dll using the full version on your PC. Then import the *.dll into Equation Editor

Learn how to Import Functions into Equation Editor

The MATLAB Compile Runtime on the VNA is currently 7.14, which is shipped with R2010b (7.11).

If you compile your *.dll using that version of MATLAB, then you don't need to change the version of MCR on the VNA.

  1. Determine the version of MATLAB you will use.

  1. Install MATLAB (32-bit) on your development machine.

  2. Install a compatible C++ compiler on your development machine.

  1. In MATLAB, select your installed compiler by running the command: >> mbuild -setup

  2. Install the correct MCR on all target machines. This requires a reboot even if not prompted to do so by the installer.

Creating a MATLAB DLL

  1. Open the MATLAB Compiler Deployment Tool, either through the user interface or with >> deploytool, and choose to make a "C++ Shared Library" project.

  2. Add any .m files to your project that you need in the DLL through the Deployment Tool window. This includes any helpers for functions need to execute.

    1. Functions must take in 0 to 32 arguments and return 1 value to be used on traces.

    2. The return value can be an array the size of a trace or a single value.

    3. Functions not conforming aren't directly accessible from Equation Editor but must be included if other functions rely on them.

  3. Optional: Add function descriptors. These are separate functions which provide default arguments and tooltips for the function.

    1. Descriptors must have the same name as the function they describe with the postfix “desc”. For example, “MyFunc” could have a descriptor “MyFuncdesc”.

    2. Descriptors take no input arguments.

    3. Descriptors return a single string with the format “defaultArgs;tooltip”. For example, “S11,S22;Performs an operation.”

  4. Build the project. This may take a few minutes and, if there are no errors, will generate project, src and distrib folders. The DLL will be under the distrib folder.

    1. Some of the other generated files may be useful but are not needed for Equation Editor.

  5. Optional: Package all the distributable files.

    1. This package can also include the appropriate MCR installer (as large as 0.5 GB).

    2. In general this step isn't needed, only the generated DLL is required.

Notes about Writing Scripts

The MATLAB functions that will be accessed directly by the Equation Editor must follow a specific format, as noted briefly above.

Functions with other input/output sets are not directly accessible from Equation Editor but may be included in your DLL and used by other functions, meaning helpers can be used without risk.

Existing functions that do not fit these parameters can be included along with wrapper functions which convert the parameters and outputs within the MATLAB environment.