Table Of Contents

Migrating from MathScript Node to Interface for MATLAB®

Last Modified: November 26, 2019

Use an Interface for MATLAB to migrate source code that contains a MathScript Node.

When you open a VI containing a MathScript Node, the MathScript Node is replaced with a Sequence Structure and the original MathScript code is converted to a MATLAB file (.m). The VI is broken and you must modify the code to replicate the behavior of the original code.

Complete the following steps to migrate your code:

  1. Ensure that the generated MATLAB file works in MATLAB.

    Refer to the comments in the Sequence Structure to locate the MATLAB file on disk. If the MATLAB file contains MathScript-specific function names, you must modify the file to use MATLAB function names. Refer to Migrating MathScript Functions to MathWorks® Functions for more information about mapping MathScript function names and their corresponding function names in MathWorks products.

  2. Create an Interface for MATLAB to call the MATLAB file.
    • You must choose Function as the File type on the Document tab because the generated MATLAB file is a function.
    • You must configure parameters of the interface node using consistent input/output arguments in the MATLAB file. Find input/output arguments of the MATLAB file from comments in the Sequence Structure.
  3. Return to the VI diagram and rewire controls and indicators to the interface node.
    1. Click Project Files» Software , select the interface node, and drop the interface node on the diagram.
    2. Wire controls and indicators to the interface node by replicating wire connections to the Sequence Structure.
    3. Remove the Sequence Structure and clean up the diagram.
    4. Save the VI.

Notice that the VI is no longer broken. The modified code has the same behavior as the original code.

Recently Viewed Topics