LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I find functions?

In other programming languages, if a function is used, e.g., foo(), then by simply remembering the name, one is able to use the use it again. 

 

However, in Labview when I see a function in an example program and use it in my own, I have a hard time calling it unless I copy paste it. 

 

I may have missed a tutorial on this. Is there a link for one?

 

 

For example the function, "VISA session out" , I cannot seem to find it as shown below. 

 

Untitled.png

0 Kudos
Message 1 of 7
(6,268 Views)

You want a VISA constant?  Nope, I do not think that is in the palettes.  Put down a VISA Control on the front panel.  You can always change it to a constant if that is really what you want.

 

But as far as searching, there are 3 ways:

1. Quick Drop - Hit Crl+Space, type in the name of the function you want, and click where you want it.

2. Use the search in the palettes (top right corner of the function palette).

3. Use the LabVIEW search in the top right corner of the window, next to the button for the Context Help



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 7
(6,255 Views)

Don't forget 2 other methods:

 

1. If you right-click on a VI on the block diagram, one of the menu options is usually the palette menu where it came from, so you can find related functions easliy.

2. If you right-click a wire or a VI terminal on a block diagram, one or more of the menu options will be a palette menu that relates to it.

Message 3 of 7
(6,237 Views)

crossrulz, Kyle,  you missed the absolutly most useful way.

 

#Primus: look in the LabVIEW Help file

!0.png

The Owning Palette is on the second line, and after reading the first paragraph you should know if this is the function you want.  Then there are links to either drop it on the active BD or navagate to the palette!  And look at that links on the bottom (not shown) to open Examples or find related examples.  Links to advanced concepts are also included.  Do you need a refresher on format string syntax? Its a click away!  


"Should be" isn't "Is" -Jay
Message 4 of 7
(6,195 Views)

@SeriousTyro wrote:

In other programming languages, if a function is used, e.g., foo(), then by simply remembering the name, one is able to use the use it again. . 


Your premise is quite distorted because you seem to imply that "simply remembering" is somehow trivial, even if you have thousands of functions, some even with similar sounding names. (for example Is the word "log" natural, base2, or base10 :D). Not only do you need to remember the function name, but also how to spell it. This is not necessarily simple. Also a fraction of the population is dyslexic where these things are significant hurdles.

For a recent example maybe you remember the "Adele Dazeem" vs. "Idina Menzel" confusion by John Travolta at the Oscars. I guarantee you that a significant number of text programmers made similar flubs in their code.


@SeriousTyro wrote:

 

However, in Labview when I see a function in an example program and use it in my own, I have a hard time calling it unless I copy paste it. 

...

For example the function, "VISA session out" , I cannot seem to find it as shown below. 


Your VISA thing is a parameter, not a function. The name is meaningless, because you can change the label to anything you want. It is a diagram constant, i.e. a data source for a wire, where the value is compiled into the code and cannot be changed at runtime because there is no front panel terminal. I assume you are needing it to wire to a visa function. One of the most powerful tools in LabVIEW is "right-click...create control|indicator|constant". You can do that on any terminal of any function. In this particular case, you would start by placing any VISA function that you need anyway e.g. VISA open (why else would you need that constant?! :D), then you right-click on the upper left terminal followed by "create constant". Not only do you get the desired constant, it is even already wired to the connector. Now change the label if desired. 😄

Basically, you are asking the terminal what it wants. This is extremely useful for more complicated inputs such as clusters. For example if you need to wire an input to the termination condition input of nonlinear fit, you can tediously create a cluster with the correct elements and correct order from scratch, or you can just right-click the input terminal and create a constant or control. Not only is everything of the correct datatype, even all the parts are labeled correctly! :D. (it gets a bit more complicated for terminals that accept a rich variety of input datatypes, such as e.g. xy-graphs. Only the programmer knows what datatype he actually wants here (array of points, cluster of arrays, complex array, etc.))

 

Others have already mentioned search, quickdrop, and such. There are all good tools!  It seems you just started with LabVIEW and  you are still having the "deer in the headlights" experience. Trust me, it does not take much longer and you'll program like a master. Don't be afraid to right-click anything. Typically what you need will be right there! With a little bit more experience, the LabVIEW environment will fit you like a glove.

 

 

 

Message 5 of 7
(6,179 Views)

Thanks gents. I'm getting familarized with LabView and I value being able to navigate through the IDE and debugging proficiently. 

0 Kudos
Message 6 of 7
(6,083 Views)

For debugging proficiency, the post right before yours was the most useful.  In your example, foo() has no input parameters.  It is a function.  In your LabVIEW example, you showed a parameter and asked how to find functions.  You'll be much happier if you learn to tell the difference between the two in LabVIEW as well.

0 Kudos
Message 7 of 7
(6,059 Views)