LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use text based code in Labveiw

Hi I am a new LabVIEW user. I am a computer scientist and am used to text based coding and not the G programming that LabVIEW uses. So I am wondering if there is a way to type text based code into LabVIEW and if so what language(c, c++, etc.) it uses. Any help you can gve would be greatly appreciated.

0 Kudos
Message 1 of 24
(16,881 Views)

It is possible to use text based programming languages in LabVIEW. NI actually has a manual dedicated specifically to using external code in LabVIEW, and details how to do so.

https://www.ni.com/docs/en-US/bundle/370109b/resource/370109b.pdf

 

I personally have never used external code in LabVIEW, but I hope this helps 😃

 

0 Kudos
Message 2 of 24
(16,877 Views)

Thanks this should help me out.

0 Kudos
Message 3 of 24
(16,872 Views)

@BretD wrote:

It is possible to use text based programming languages in LabVIEW. NI actually has a manual dedicated specifically to using external code in LabVIEW, and details how to do so.

https://www.ni.com/docs/en-US/bundle/370109b/resource/370109b.pdf

 

I personally have never used external code in LabVIEW, but I hope this helps 😃

 


I don't think this is what the OP was asking. If I am correct the OP was asking if they could actually type text based code into LabVIEW and have it execute. The answer to that is no. That would be like typing in Java code in a C program and expect it to work. There is limited capability using the formula node but that basically is used for calculations and equations.

 

If you are going to use LabVIEW I suggest you learn the language. It is a very powerful and capable language. In addition, once you learn the language it is, in my opinion, much more productive than text based languages. I know that I can write code MUCH faster in LabVIEW than I can in C or C++.

 

My degree is in Computer Science and I started my career writing code in C and then in C++. In the mid '90s I started working with LabVIEW. Given my preference I will write code in LabVIEW. It is a great language and I do believe that graphical programming will be the norm in the not too distant future. Hopefully it will be LabVIEW but regardless, I do believe that graphical programming languages will become much more prevalent.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 24
(16,866 Views)

@dpkiley wrote:

Hi I am a new LabVIEW user. I am a computer scientist and am used to text based coding and not the G programming that LabVIEW uses. So I am wondering if there is a way to type text based code into LabVIEW and if so what language(c, c++, etc.) it uses. Any help you can gve would be greatly appreciated.


If you have the Pro (or Full?) development system you may already have LabWindows/CVI.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 5 of 24
(16,854 Views)

I do have the full version. Where would I go to find LabWindows/CVI if I do have it?

0 Kudos
Message 6 of 24
(16,840 Views)

Don't bother unless you have the developer's suite. CVI does not come with any version of LabVIEW.

0 Kudos
Message 7 of 24
(16,838 Views)

First, see if you have to use LV. If you're more comfortable with C, that might be a better choice for you at the moment. You could also create DLLs in C and call them from LV (which is probably what the first reply points to), but that's not a very natural process in LV.

 

Second, assuming you continue to use it, go and read Mark's reply again, and then try to have fun. LV uses a completely different paradigm from C and some people have a very hard time wrapping their heads around it, but if you can make the transition, you'll find that LV has some very interesting computer science principals behind it and that you get all kinds of cool perks (small example - functions can have more than one return parameter, and it's completely intuitive).

 

Be aware that this programming style has its pitfalls, especially for someone who's already used to C, with the biggest probably being race conditions. If you run into the term "local variable", go the other way. It's an unfortunate name for something that has its uses, but can be very confusing to someone who's used to C.


___________________
Try to take over the world!
Message 8 of 24
(16,802 Views)

@dpkiley wrote:

So I am wondering if there is a way to type text based code into LabVIEW and if so what language(c, c++, etc.) it uses. Any help you can gve would be greatly appreciated.



You can use the mixed approach, for example you can use the formula node to "type text based code into LabVIEW" (your words). There is also Mathscript node (costs extra) that allows you to use matlab style syntax.

 

If you have matlab, you can use the matlab script node.

There is also the free open source scilab alternative, which has a LabVIEW to Scilab Gateway that you can download.

 

Personally, I would recommend to embrace LabVIEW graphical programming, many reasons have already been mentioned. Once you are a bit more fluent, you'll never go back to text based code. 😄

 

Think about it: The need to express your thoughts as a linear string of monochrome characters is very limiting. A graphical programming language allows to circumvent that bottleneck. LabVIEW easily allows concurrent parallel processes and is actually much closer to the generated machine code than text based code can ever be. For example, have a look at this article: NI LabVIEW Compiler: Under the Hood

 

0 Kudos
Message 9 of 24
(16,796 Views)

@tst wrote:

Second, assuming you continue to use it, go and read Mark's reply again, and then try to have fun. LV uses a completely different paradigm from C and some people have a very hard time wrapping their heads around it, but if you can make the transition, you'll find that LV has some very interesting computer science principals behind it and that you get all kinds of cool perks (small example - functions can have more than one return parameter, and it's completely intuitive).



Sorry, but your example is just wrong. You can return anything you want in C (thousands of paramters if you want to).

0 Kudos
Message 10 of 24
(16,782 Views)