LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

matlab .net assembly crashing LabVIEW

Hello all,

 

I wrote a function for image recognition in matlab, and I want to integrate it with a labview program, so I used deploytool in matlab to build a .Net Assembly of my function that I can load in labview.

 

The compiler generates two files: myfcn.dll containing the generated component using MWArray API, and myfcnnative.dll containing the generated component using native API.

 

So I tried loading loading myfcnnative.dll into labview and when I run the program I get System.IO.FileNotFoundException and labview crashes.

 

Does anyone have any experience with that?

 

Thanks

0 Kudos
Message 1 of 5
(3,045 Views)

Hi Moobe.

 

Just to be sure we're all on the same page, what versions of LabVIEW and MATLAB are you using?

 

Previous fixes for an error like this usually involve making sure the function path is correct for the files you want to load. Where does your program create myfcn.dll and myfcnnative.dll? Also, when you load myfcn.dll into LabVIEW, do you get the same error or does it work? If neither dll works with LabVIEW, try copying the .dll file into the directory containing LabVIEW.exe. If myfcn.dll works but myfcnnative.dll does not, what are the differences between the two files?

 

Another method might also work. Have you considered just using a MATLAB script node? It can be found in the Functions palette under Mathematics -> Scripts and Formulas -> Script Nodes.

 

Hope this helps. Let us know if you have any other questions.

Josh Y.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(2,978 Views)

Hi JoshY,

 

I am using labview 2010, and Matlab 2011b 64-bit.

 

The function path is correct. Matlab creates the dll files in a file on C:\, I load it to labview directly from there. I tried also puting the dlls into the directory containing LabVIEW.exe and still got the same result, labview crashed after generating the above error.

 

I am aware about the Matlab script node, and use it often, however in this case, the M script node is not recognising a lot of the functions and characters in my matlab code, that the reason I decided to create a .net assembly file of my function.

 

Thank you.

0 Kudos
Message 3 of 5
(2,965 Views)

Hi Moobe.

 

Does this dll work when you call it in MATLAB? If not, then there may be an issue with the assembly itself, and you would have to address that in MATLAB.

 

If so, can you call a generic (Hello World) assembly from MATLAB in LabVIEW? You may want to create a 32 bit as well as a 64 bit assembly to ensure the calling function is working correctly. I’m assuming you’re using the 32 bit version of LabVIEW, is this correct? Also, is the problem only with myfcnnative or with myfnc as well?

 

If calling these generic assemblies work and it’s not a 32 bit to 64 bit compatibility issue, then how are you calling this in LabVIEW? Could you post a screenshot of this section in your code?

 

Regards.

Josh Y.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(2,952 Views)

Hi Moobe,

did you solve the problem ?? Were you able to call the Matlab .Net assembly in LabView ?

0 Kudos
Message 5 of 5
(2,752 Views)