LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling VI script from MATLAB

Solved!
Go to solution

I wanted to run a VI script from MATLAB, and I looked up the Internet how to do so. I learned that if I used the following commands, I could run a VI.

 

e=actxserver('LabVIEW.Application');
vipath='c:\Documents\Labview files\test.vi';
vi=invoke(e,'GetVIReference',vipath);
vi.Run

But this gives me an error.

 

Error using
COM.LabVIEW_Application/GetVIReference
Invoke Error, Dispatch Exception:
Source: LabVIEW
Description: LabVIEW:  Open VI Reference no
longer matches VIs in memory by filename. A
filename is no longer sufficient because the
full name of a VI now includes any owning
libraries.

Error in readColorVI (line 7)
vi=invoke(e,'GetVIReference',vipath);

Does anyone have an idea what should I include apart from the file path to get the script running?

Thanks

 

0 Kudos
Message 1 of 8
(4,192 Views)

Does the script run correctly in the LabVIEW environment?

Chase
NI Technical Support Engineer
0 Kudos
Message 2 of 8
(4,133 Views)

Yes, it works perfectly.

0 Kudos
Message 3 of 8
(4,123 Views)

Is that particular test.vi using any calls to sub-vis ?

0 Kudos
Message 4 of 8
(4,108 Views)

If it works in LabVIEW, I would follow The Math Work's instructions and create a ticket with them if that does not work correctly.

 

https://www.mathworks.com/help/matlab/matlab_external/run-external-commands-scripts-and-programs.htm...

 

Chase
NI Technical Support Engineer
0 Kudos
Message 5 of 8
(4,093 Views)

The VI does call a sub VI, and that very well could be the problem. If there's a solution to it, I'd be glad to hear it. 

 

If there isn't, then I'll raise a ticket at Math Works. 

0 Kudos
Message 6 of 8
(4,084 Views)
Solution
Accepted by topic author DeepPars

The easiest way to find out is to eliminate the subVI call and see if it still errors.  If so, it's not the subVI

Message 7 of 8
(4,074 Views)

But what is the Win OS system command for running a VI?

0 Kudos
Message 8 of 8
(3,558 Views)