LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dll, matlab an LadVIEW

I'm also curious since the above pdf file has obsolete matlab compiler switches for v7 R14.  Is the wrapper file still necessary for LV8 and/or Matlab v7?

Thanks

0 Kudos
Message 11 of 86
(5,154 Views)

Hi,

Did anyone solve this problem for Matlab 7 and LV7? I tried changing all kinds of things in the former solutions, and the best case is "Error in call library function node", while the worst case is a segmentation fault.

I created a function foo that multiplies by 2, and created a c wrapper function that converts the matlab variables. for generating the c code I did: >> mcc -v -W lib:foolib -c foo.m

For generating the dll I did: >>mbuild -v foolib.c foo_wrapper.c  foolib_mcc_component_data.c foolib.exports

The dll is created and is recognized by Labview, but that's as far as I got...

I would really appreciate any help or examples.

Thanks

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 12 of 86
(5,122 Views)
Hello,
 
The following has information which you may find useful in providing you a different mechanism for using your existing code:
 
Working with User-Defined Functions in LabVIEW MathScript
 
I hope this helps!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 13 of 86
(5,104 Views)

Thanks for the suggestion, but I think that for this option matlab has to be installed on every computer that I wish to deploy my labview vi to. That's why I am looking at the .dll option.

Thanks again

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 14 of 86
(5,103 Views)
Hello,
 
You will not need matlab installed on every machine for that - the MathScript node is different than a matlab scriptnode.  The MathScript node however is only available in LabVIEW 8.0 and later.  I think these problems arise as a result of matlab accepting and interpreting parameters passed to it in a unique way.  Perhaps you know more about this, but in the past I believe people have had to play with "converting" the data before passing it, and perhaps converting again for data that is passed back.  I'm not sure if this is the case for all datatypes, and unfortunately I don't know the details of this for any datatype.  If you know of such a specification however, I can try to help you define the data manipulation code on the LabVIEW side so that you can communicate with your dll.  Does this sound like a plausible explanation for the problems you are having?
 
Sorry this post is so vague, but perhaps it'll lead you in the right direction.
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 15 of 86
(5,090 Views)
If you plan to release executables to your production machines, then I don't think MathScript will work.  I thought I remembered reading that MathScript isn't supported in the application builder, yet.  Check with NI to verify this, though.

Thanks
0 Kudos
Message 16 of 86
(5,081 Views)

Hi,

Attached are my files, including the dll and the vi that I used to test it. As of now, it doesn't work. If anyone has any suggestions, that would be great.

The c files were created using: >>mcc -v -W lib:foolib -c foo.m mclmcrrt.lib mclmcr.lib (I added the libs because I saw that microsoft visual c++ can't find these libraries, but I don't know if it actually helps. Without them it doesn't work either).

The dll file was created by adding the line func_wrapper to foolib.exports and >>mbuild -v foolib.c func_wrapper.c  foolib_mcc_component_data.c foolib.exports.

I am using matlab7 and LV7, windows 2000/XP (both).

Labview recognizes the dll and the function func_wrapper in the dll, but it throws an error when executing.

Thanks very much to everyone

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 17 of 86
(5,069 Views)
Hello,
 
DerekSRD is correct regarding building standalone applications with VIs that use MathScript - it won't work.  The following is a good document about MathScript known issues and limitations:
 
LabVIEW MathScript Known Issues and Limitations
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 18 of 86
(5,064 Views)
Hello again,
 
Just a note - I cannot attempt to run your code because mclmcrrt71.dll cannot be found - I believe this is a dll which ships with non-LabVIEW software, and limits the extent to which I can test this.
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 19 of 86
(5,062 Views)

Hi,

Sorry, for some reason I thought you had matlab. Attached are the dll's - I hope that I included all of them.

Thank you very much!

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 20 of 86
(5,046 Views)