‘LabVIEW’ Category Archives

28
May

Replace and Paste-Replace

by Christina in "Hidden" Features, LabVIEW, User Interface

There are multiple ways to replace things in your VIs. Knowing your different Replace options can help you choose the one that best fits your needs.

Replace Shortcut Menu

On the front panel, you can right-click on a control and choose one of the options from the Replace menu. This method will preserve some things about the original control. Unfortunately, it’s not obvious what things will be preserved. In most cases, LabVIEW will attempt to preserve the label, caption, value and dataflow direction (control/indicator). It may also try to preserve other things, such as the numeric representation, size or color. It’s hard to say what will be preserved without actually doing the replace.

Luckily, you have Undo if a right-click replace operation doesn’t do you what you want. But what do you try next?

Paste-Replace is a method of replacing a control without preserving any of its appearance attributes. It will, however, preserve things like connector pane placement, wire connection and associated block diagram elements (e.g. local variables and implicitly-linked Property/Method nodes). (By the way, right-click Replace preserves these things as well).

To use Paste-Replace:

  1. Place the control you want.
  2. Use Edit>>Cut (from the menu, or via keyboard shortcut) to put it on the clipboard.
  3. Select the control you want to replace.
  4. Use Edit>>Paste.

Note that Paste-Replace is not available when editing the LabVIEW block diagram. On diagrams, you almost always use right-click Replace. However, some structures (such as loops) have special Replace menu options to replace them with other structures without losing their contents.

Read the rest of this entry »

16
May

For Loop Examples

by Christina in Examples, LabVIEW

Thanks for all the responses to my last post! The humble For Loop is much more complicated than it appears at first glance. (I’ll get to While Loops as well, but later).

Here’s a recap of the suggested “function” examples:

  • Contrasting the For Loop’s operation (iteration from zero to N times) with a While Loop’s operation (iteration until a condition is met).
  • Automatic indexing
    • 1D array
    • 2D array (row vs. column, how to transpose if needed)
    • Multiple indexing sources (and which will stop the loop)
  • Shift registers
    • passing data to the next iteration of the loop
    • uninitialized shift registers
    • shift registers with depth > 1
  • Reading the N terminal inside the loop
  • Conditional terminal to “break” the loop early

And the suggested “concept” examples:

  • How to stop the execution of parallel loops
  • How to control loop timing (including the Timed Loop)
  • For Loops that execute zero times – how to know when it can happen and how to handle it correctly
  • Error handling in loops
  • Data communication between loops. (I’m going to punt on this one. Anyone who heard about this year’s CLA Summit knows that Data Communication in LabVIEW is a huge topic, and not something I can address with a simple example. Rest assured, there are people working on clarifying the data communication options for our customers and I’ll keep you posted about what they come up with).
  • Performance considerations (e.g. optimizing loops), including the Parallel For Loop.

And the suggested “application” examples:

  • Filtering an array to only the elements meeting a constraint
  • Displaying progress of a loop

Whew! Well, as the saying goes, the longest journey begins with a single step, so let’s get started.

Here’s a simple For Loop example: For Loop Basics (I’m not claiming this VI is perfect; it’s just something I put together quickly).

For Loop Basics Front Panel
For Loop Basics - Example

Here are some experiments I’d like feedback about:

  1. It’s an exercise. Rather than just giving you something to run, it has steps which require you to edit the VI. Do you like examples like this?
  2. The instructions are on the panel in a String control. This approach has some advantages over a free label (e.g. it gives us a scrollbar, which handles system font changes more gracefully) and some disadvantages (e.g. you probably wouldn’t use controls for documenting “real” VIs). What do you think of this idea? Also, would you rather have the instructions on the diagram?
  3. It’s built so that it can be a VI Snippet, which means that (if you’re using a supported web browser and LabVIEW 2009 or later) you can drag it to a VI diagram. Is this useful at all?
13
Apr

What Does a Loop Example Need?

by Christina in Examples, LabVIEW

Loop Quandry Cartoon
The recent LabVIEW Example contest got me thinking about our example offerings. I categorize LabVIEW examples three ways:

  • Application examples. These examples are fully-functional applications that show off what LabVIEW can do. They can be great starting points for building your own, similar applications. However, they’re usually difficult to learn from because they are large and contain many different concepts. These kinds of examples seem to be popular in contests.
  • Concept examples. These are “teaching examples” that illustrate a concept. Although not VIs that you would modify and incorporate into a real application, they can present “how to” information with minimal extra code.
  • Function examples. I think these examples are the unsung heroes of the example world. With a good example, you can quickly learn what a function can do. Sometimes you can also learn what a function can’t do or common mistakes in its usage.

Even though Concept and Function examples are smaller than Application examples, they can be just as difficult to write. They require having a thorough understanding of the material without having lost sight of the new user’s point of view. In my experience, people who have taught LabVIEW are invaluable when it comes to crafting these kinds of examples.

Another recent, thought-provoking event for me was NI Tech, an NI-internal R&D conference. In two of her presentations, Nancy Hollenback (who recently re-joined NI as a Field Architect – more on that in a future post!) showed a slide illustrating several “hurdles” that LabVIEW users encounter when progressing from the “three icon demo” to large systems.

The first of these hurdles was “arrays and loops.”

Having been thus inspired, I’m now setting out to find (or build) the best possible function/concept examples for loops. There are somethings I already know they need to show:

  • how to decide if you should use a For loop or a While loop
  • array indexing on loop tunnels
  • the “zero iteration For loop” problem
  • early termination of For loops (“For loop with break”)
  • loop timing.

What other things would you expect from loop examples? Do you have any examples (from NI or elsewhere) that you recommend? Please send them my way!

6
Apr

Example Program Challenge 2011 Winner

by Christina in Examples, LabVIEW

Winning Example Application

Congratulations to peter_smith, the winner of the LabVIEW Code Madness: Example Program Challenge 2011!

His winning entry was: Browse NI Community User Groups and Sort Documents as You Want! This code allows users to extract all documents from a Community Group and sort them by their score. As the code progressed through the rounds of the challenge, peter_smith added the functionality to display the selected document in a new LabVIEW window and generate a report of the selected group. The final code extension during the Finals round allows users to store reports in the Amazon S3 cloud storage service.

I am impressed with this example’s attractive user interface and clean, commented diagrams. I hope you check it out!

4
Feb

LabVIEW 2011 Beta Program

by Christina in LabVIEW

NI is now accepting requests to join the LabVIEW 2011 Beta Program. Visit ni.com/beta to sign up.

As you may have heard at NI Week last August, the main focus of this release is improving performance and stability. It will also include some features that were suggested on Idea Exchange. However… there is a little extra something I’m working on that needs some fine-tuning before its final version ships and I’d like to hear your opinions on how it should work. So please, if you have time, join the Beta program and then talk to me on the Beta discussion forum. The Beta software should be available soon; if you join the program now, you’ll be notified when it’s ready to download.

26
Jan

Graphical System Design Achievement Awards

by Christina in LabVIEW, NI Week

Comments Off on Graphical System Design Achievement Awards Comments

It’s hard to believe it’s already time to start planning for NIWeek 2011! Here’s a way you can win a free trip…

Submissions are now open for the Graphical System Design Achievement Awards, the National Instruments technical application contest, showcasing the most innovative projects based on NI software and hardware.

Category finalists will be awarded with a free trip to NIWeek 2011 in Austin, Texas, and the Customer Application of the Year will win one year of free NI Training.

For more information on the 2011 Graphical System Design Achievement Awards and how to participate, visit ni.com/gsdawards. Or, submit your paper now.

The deadline for submissions is April 1, 2011.

20
Sep

LabVIEW Example Contest

by Christina in LabVIEW

Announcing a contest on ni.com/community where you could win an iPad!

To enter the contest, you will need to submit your own LabVIEW example in one of the following categories:

  • Data Analysis
  • File I/O
  • Math/Analysis
  • User Interface Controls
  • Games
  • VI Server/Scripting

Submissions will be open from October 1 through October 25, 2010. I will be on the committee that selects the finalists in each category. Community voting will determine the category winners. And Jeff Kodosky will select a “Best in Show” to win an iPad!

For complete rules and additional information, visit the contest site on ni.com/community.

I can’t wait to see the entries! Good luck!

[Edit – Deadline extended! Submit entries through October 25].

26
Aug

LabVIEW Radio Buttons without Frames

by Christina in LabVIEW, User Interface

Radio Button Group Example

Radio Buttons

The intended purpose of a radio button group is to select one (and only one) option from a set of choices. Microsoft has a detailed article on radio button usage guidelines on MSDN. (Although I should note that I don’t agree with all their guidelines).

LabVIEW introduced the radio buttons control in version 7.1. [Before then you had to write diagram code to ensure that only one radio button in a group was TRUE at a time, which was very annoying. Individual radio buttons are still in the palettes and I sometimes see them being used inappropriately, e.g. in place of a checkbox].

Unfortunately, the radio buttons control is somewhat confusing to new users. Here are the basics:

  • The group of radio buttons is a single control, with a single terminal on the diagram. Like a cluster, you don’t get terminals for the controls inside the group.
  • The radio buttons value is an enumeration of the contained button labels.
  • Similar to a cluster, you add radio buttons by placing them inside the bounds of the group. (You can also right-click on the group border and select Add Radio Button).

Read the rest of this entry »

23
Aug

LabVIEW 2010 Help Links for Controls

by Christina in "Hidden" Features, LabVIEW

I don’t think I can do a better job of showing off the top new features of LabVIEW 2010 than the official New Features in NI LabVIEW 2010 page or Darren’s nuggets.

So instead I’ll share a small enhancement that you may sometimes find handy.

Have you ever needed to refresh your memory (or teach someone else) the differences between the various LabVIEW graphs and charts? Or what data shapes (arrays, clusters, arrays of clusters, etc.) a graph accepts and how it displays them?

You know it’s all described in the Help, but it’s hard to find the right topic for a particular type of graph or chart, right?

Well, in LabVIEW 2010 you can use the Context Help window, mouse over a control and see a “Detailed Help” link that will take you to the help topic for that type of control.

The link only appears when the VI is in edit mode because the context help on a running VI belongs to you, for whatever description of the control you want to provide for the operator of your VI.

17
Aug

Custom Toolbars for LabVIEW VIs

by Christina in LabVIEW, User Interface

Have you ever wanted to make a custom toolbar on a VI?

I put together a small example VI to show how this might be done: Toolbar Example

Read the rest of this entry »