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:
-
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.
-
Create an Interface for MATLAB to call the MATLAB file.
Note
-
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.
-
Return to the VI diagram and rewire controls and indicators to the interface node.
-
Click
, select the interface node, and drop the interface node on the diagram.
-
Wire controls and indicators to the interface node by replicating wire connections to the
Sequence Structure.
-
Remove the
Sequence Structure
and clean up the diagram.
-
Save the VI.
Notice that the VI is no longer broken. The modified code has the same behavior as the original code.