LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compiling VIs with Matlab scripts

Hi everyone,

 

I need to build application for a VI with some matlab scripts included in the block diagrams using the Matlab scripts node. I've been searching for related topics and I'm hoping someone can help me understanding the big picture here.

 

Background info: I'm using LV2012, Matlab 2013. I DON'T USE MathScript RT Module.

 

Question:

1. To build a stand-alone application for the use on a PC with Matlab software but no LabVIEW, do I just simply build the application in LabVIEW project?

2. To build a stand-alone application for the use on a PC wthout Matlab and LabVIEW, do I need to create a DLL from Matlab and modify my VI to use "Call library function node" and then build the application in LabVIEW project?

 

Thanks for answering my questions!

0 Kudos
Message 1 of 6
(3,740 Views)

Question:

1. To build a stand-alone application for the use on a PC with Matlab software but no LabVIEW, do I just simply build the application in LabVIEW project?

 

Yes,  Assuming it is a windows machine and the Licensed version of Matlab is version 6.5 or later the LabVIEW Run-Time engine knows how to call the Matlab script server through Active X.

 

2. To build a stand-alone application for the use on a PC wthout Matlab and LabVIEW, do I need to create a DLL from Matlab and modify my VI to use "Call library function node" and then build the application in LabVIEW project?

 

You cannot use a Matlab math script node without a licensed version of Matlab 6.5 or later resident on the target and the target must support Active X so, Windows only.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 6
(3,728 Views)

2. To build a stand-alone application for the use on a PC wthout Matlab and LabVIEW, do I need to create a DLL from Matlab and modify my VI to use "Call library function node" and then build the application in LabVIEW project?

 

You cannot use a Matlab math script node without a licensed version of Matlab 6.5 or later resident on the target and the target must support Active X so, Windows only.

 

 

So in this case, I need to compile my .m file in Matlab into DLL and use the DLL in my VIs, right? Any details on how to implement this are appreciated!

0 Kudos
Message 3 of 6
(3,721 Views)

Hello,

 

After you create your DLL from the MATLAB® environment, you can then use a Call Library Function Node to call that DLL from your LabVIEW VI. When you create a DLL from the LabVIEW VI, the MATLAB® DLL won't be automatically included inside the LabVIEW DLL. You need to make sure that they accompany each other and that all paths to external code are referenced correctly. If you don't use correct file path references, you will run into "File no found" errors.

 

Creating a DLL from LabVIEW code

https://decibel.ni.com/content/docs/DOC-15556

 

MATLAB® is a registered trademark of The MathWorks, Inc.

 

Hope this helps!

 

Aldo A
Applications Engineer
National Instruments
Message 4 of 6
(3,678 Views)

Aldo,

I'm not trying to build a DLL fro LabVIEW. I'm trying to build an EXE from LabVIEW. In my case, will it be just a straight forward application builder procedure? Thanks.

0 Kudos
Message 5 of 6
(3,657 Views)

Hi Z.Wei,

 

Yes; I recommend that you study this KB before you build your exe with the DLL.

 

Why Can't My Stand-Alone Executable Find My DLL, Even Though I Have Specified the Path for the DLL?
http://digital.ni.com/public.nsf/allkb/862567530005F09C862565C50068363D

 

It will prevent a lot of headaches in the future 🙂

 

 

Aldo A
Applications Engineer
National Instruments
0 Kudos
Message 6 of 6
(3,627 Views)