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 PNA, MATLAB functions can be called directly from Equation Editor.

  1. Install the full 32 bit version of MATLAB.

  2. On the PNA in the Equation Editor dialog, click enable MATLAB

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

  4. 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 PNA 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 PNA.

  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 prototype (default) arguments for another function, named ‘myFuncdesc’ for every function.

    1. These functions must take no arguments and return a single string, of the form:
      ‘arg1,arg2,…’  or  ‘arg1,arg2,…;tooltip’
      where arg1,arg2,… is a list of arguments, and tooltip is an optional tooltip text to be used in future releases.

  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.


Last Modified:

12-Dec-2013

New topic