LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using a lbavie vi in c and matlab

I have a labVIEW VI that I would like to use in programs writen in either Matlab or C.
the ideal for me would be if I could just write something like 

 

a = VI(argument1, argument2);

 

in my C/Matlab code.

I know there is a way of doing it, but I can't find a step by step guide writen for someone like me who knows nothing about activeX and DLLs.
Does anybody knows something like that?


thanks!

0 Kudos
Message 1 of 5
(2,578 Views)
OK,

Step 1: Learn about DLLs.

Seriously though, you can create a DLL that encapsulates your VI, and it's pretty straightforward. There is an example that does something simple like add two numbers together. That can be Step 2.

The only strange thing I have encountered is that sometimes a DLL you create in LV will work fine when called from an external language, but dies if run from LV! Very strange.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 5
(2,561 Views)

thanks a lot!
I'll read about dll and try the example out.

Message 3 of 5
(2,525 Views)

@mikeporter wrote:

The only strange thing I have encountered is that sometimes a DLL you create in LV will work fine when called from an external language, but dies if run from LV! Very strange.

Mike...

Then you probably got something wrong with the configuration in your Call Library Node. Smiley Very Happy

Or were using a very old LabVIEW version. The first one or two versions that could create DLLs from VI code, didn't handle the case gracefully where LabVIEW was calling into a LabVIEW DLL.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 5
(2,482 Views)

Another option, less elegant but probably easier to implement, is to create an executable from the VI and to call the executable from a line command with arguments. I have used this approach to call a LabVIEW 32-bit function from a LabVIEW 64-bit application. The command-line argument can be accessed through the property node (without reference) in the main VI -> Application -> Command line arguments.

Marc Dubois
0 Kudos
Message 5 of 5
(2,444 Views)