From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a VB Script and Matlab code from LabVIEW GUI.

Hi,
Can anyone help me out in Calling a VB Script and Matlab code from LabVIEW GUI? GUI will be developed in Labview and currently we have some scripts written in VB and Matlab and we need to incorporate the same through LabVIEW. Can anyone let me know how this can be implemented? 
 
Regards,
Sharmash
0 Kudos
Message 1 of 5
(3,994 Views)

Sharmash,

My first question is, why not write your program in LabVIEW instead of VB? Is the code already written in VB? If so, consider compiling your code into a dll and then using a Call Library Function Node  to call that dll. As for the Matlab portion of your question, consider the MathScript node as an option.

 

 

Chris C

Message 2 of 5
(3,971 Views)
For VBScript you can call the Windows Scripting Host application using the System Exec function, or you can use IScriptControl, which is an ActiveX control. Be aware that with the IScriptControl there's a small bug. You can read more about it in this post.

For Matlab, there's a Matlab node that you can use. You can either copy and past your Matlab script in the node, or just write a function call statement. The node simply calls Matlab. Or, you can do as suggested and use the MathScript node, which is basically an alternative to Matlab. The MatchScript node doesn't support everything that Matlab does, so you will need to check it against your script.

Or, you can do as suggested, and rewrite it all in LabVIEW, unless you can't because these scripts are used by other applications.
0 Kudos
Message 3 of 5
(3,963 Views)
Hi,
     Yes the codes are already developed in Excel , VB and Matlab. I have to interface all the three codes with labview insuch way that i should pass inputs and captures outputs from the codes after executing. I have test for matlab and it's working with matlab script. But i don't know how to do with Excel sheet. VB part I haven't tried yet, as after Excel i have to look for it.
 
how can i interface Excel Sheet with labview using Active X?
0 Kudos
Message 4 of 5
(3,898 Views)
Basically the same way you interface any ActiveX. There are examples that ship with LabVIEW that show you how to interface to Excel. You can also search the NI site for examples, as they exist there also. The "gotcha" with Excel is that each version is a little different because Microsoft changes the ActiveX interface with each version. So, if you have a version of Excel that's different from the one used in the example you may need to make small modifications to make it work with your version.
0 Kudos
Message 5 of 5
(3,892 Views)