Can I control a labview executable with matlab?
35 views (last 30 days)
Show older comments
Wouter Meekes
on 17 May 2022
Commented: Mitch Lautigar
on 17 May 2022
I'm aware this is a bit of a long shot, but it wouldn't be the first time matlab's capabilities have surprised me.
For a project, I have to make rovibrational fits to a nitrogen optical emission spectrum. The problem is that I have several thousand spectra and more to come. It would take me weeks to process them manually and so I want to automate this using Matlab. I got a program that can do these fits, but it is a labview .exe file and I have not received the source code. I was wondering if it is still possible to connect the two.
What I would like to do:
- Have Matlab give LabView a file
- Tell LabView to make a fit (the program has a designated button for this, if that helps)
- Save or extract the fitted parameters (it has a button for this as well)
- Save or extract the fitted curve (also a button)
So I tried following the procedure described here: https://uk.mathworks.com/matlabcentral/answers/391119-how-can-you-call-a-labview-vi-from-matlab-script
e=actxserver('LabVIEW.Application');
vipath='C:\Users\...\fit_spectra_N2_SPS_main.exe';
vi=invoke(e,'GetVIReference',vipath);
Obviously this wants a vi, so I tried finding what sort of method the ‘.exe’ file would be, but couldn’t find that. If I try it like this, I get the error:
Error using COM.LabVIEW_Application/GetVIReference
Invoke Error, Dispatch Exception:
Source: LabVIEW
Description: LabVIEW: (Hex 0x423) Unexpected file type.
I've also tried a suggestion on the National Instruments website (https://forums.ni.com/t5/LabVIEW/MATLAB-calling-subVi/td-p/906758) But that seems to only change the way the invoke function is called. Either way, it gives me the exact same error.
After a lot of googling and coming up empty-handed, the last thing I tried was ask a friend who - though he's not very familiar with matlab - has a lot of programming experience. He expected it to be impossible, but recommended I ask here regardless.
So is it possible to control a labview executable (which I do not have the source code for) with matlab?
If it does happen to be possible, can you point me in the right direction to get started? Because I honestly have no idea how to go about it anymore.
0 Comments
Accepted Answer
Mitch Lautigar
on 17 May 2022
MATLAB and LABVIEW are two very distinctly different programs. If you wanted to pass inputs/outputs, you could do that. But having MATLAB call a labview program is impossible.
4 Comments
More Answers (0)
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!