LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
cbutcher

Allow calling a MATLAB script via path

Status: Completed

In LabVIEW 2021, you can execute functions in MATLAB script files.

LabVIEW currently allows users to execute a MATLAB script inside the "MATLAB Script" structure, which lets you add inputs/outputs to the edge, set datatypes, and then type your MATLAB code in the central box.

 

If you already have a MATLAB script, you can use the right-click menu to "Import" (and conversely, you can test a script in LabVIEW and then Export it, if you wanted).

 

However, you cannot link to a script by path. Importing simply copy-pastes the content into the Script node. This behaviour, whilst probably useful in some cases (avoid future changes to the .m file breaking your nicely tested LabVIEW code) is different to most other nodes I can think of (Call Library Function Node, Python Node, .NET methods, ...).

 

Please add an option to pass a path to a "myFunction.m" file to the MATLAB execution system rather than copying the contents of a .m file into the structure's box.

(As a workaround, I believe this could be accomplished by running the MATLAB interpreter via command line and using the System Exec node, but that would require various path -> command line string parsing operations, and perhaps complicate cleanup of VIs using MATLAB.)


GCentral
3 Comments
cbutcher
Trusted Enthusiast

As a follow-up, if this were implemented and users were concerned about future changes breaking tested executables/packaged libraries, a nice solution would be to allow copying the "current contents" of the file at a given path into the node at build time.

This could be toggleable at (LabVIEW) edit time on a structure-by-structure basis?


GCentral
Christina_R
Active Participant
Status changed to: In Development
 

Christina Rogers
Principal Product Owner, LabVIEW R&D
Christina_R
Active Participant
Status changed to: Completed

In LabVIEW 2021, you can execute functions in MATLAB script files.


Christina Rogers
Principal Product Owner, LabVIEW R&D