Jump to content

calling matlab dlls in LV


Recommended Posts

  • 2 weeks later...

If the dll is like any other dlls, you should not have a problem. Also note that with LabVIEW 8.20, there is a DLL import Wizard to easily create VIs from the functions in a dll. This will reduce the development time by ALOT!!!!

Take a look at this tutorial:

Integrating External Code With The Shared Library Import Wizard

http://zone.ni.com/devzone/conceptd.nsf/we...6257184006BBB7A

Hope this helps,

Vincent

Link to comment
And if it's an ActiveX dll, register it and call it like an ActiveX object. The same would apply to .NET Matlab dlls, but for some reason I haven't be able to call them from LV yet.

Saludos,

Aitor

Hello,

i don't think you can call functions from matlab built dll directly in labview.

You must create a wrapper dll, which initialize the mxArray's.

cosmin

Link to comment
How can I call matlab dlls in LV? Is it torture?

Hi,

I've taken a little of my time to put something together, so you can get started. Look in the attachment for VI who use magic function from Matlab. mymagic.dll was created with matlab compiler, and Lmagic.dll is a wrapper for calling the magic function in Labview. Actually the magic.m is an example in Matlab help about how to create shared libraries with Matlab compiler.

P.S. the test.vi has a bug in it (I do not have time to look deeper), it works only once. It seems that the mclTerminateApplication function does not terminate de mclapp or is something else. Look in the Mathworks docs for some more info. You have to exit labview for the mclInitializeApplication to work again.

cosmin

Download File:post-4089-1156256245.zip

Link to comment
  • 2 weeks later...
P.S. the test.vi has a bug in it (I do not have time to look deeper), it works only once. It seems that the mclTerminateApplication function does not terminate de mclapp or is something else. Look in the Mathworks docs for some more info. You have to exit labview for the mclInitializeApplication to work again.

cosmin

hi,

actually the issue with mclInitializeApplication and mclTerminateApplication is not a bug. Mathworks web site says that mclInitializeApplication must be called only once per application. So in our case that application is Labview.exe. In the wrapper dll it must be created an init function and close function, to call only once mclInitializeApplication and mclTerminateApplication

cosmin

Link to comment
  • 2 weeks later...
hi,

actually the issue with mclInitializeApplication and mclTerminateApplication is not a bug. Mathworks web site says that mclInitializeApplication must be called only once per application. So in our case that application is Labview.exe. In the wrapper dll it must be created an init function and close function, to call only once mclInitializeApplication and mclTerminateApplication

cosmin

I had the same problem and solved with a VI server calling the dll, but in 8.20 u have the option to call a dll dynamiclly if i

Link to comment
  • 1 year later...

QUOTE (bellander @ Sep 13 2006, 05:27 AM)

I had the same problem and solved with a VI server calling the dll, but in 8.20 u have the option to call a dll dynamiclly if i´m not misstaken. Anyway the program was very unstable and

i therefor contacted Mathworks support which told me that they had a bug in the init and terminate function when compiling to a dll.

Did you ever get Mathworks to send you a fix? I am now trying and seeing the same problem.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.