What Are LabVIEW Coding Best Practices?

Updated Aug 10, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • Where can I find LabVIEW coding best practices? My code is getting messy and I'd like to make sure I'm doing things right.
  • I'm new to LabVIEW and my code is inefficient. What are some of the ways that I can improve my code?

Solution

The following list outlines some initial considerations that should be made when programming in LabVIEW.
  • LabVIEW code should always use error wires to force execution flow wherever possible.
  • Local Variables and Global Variables should be avoided unless absolutely necessary.
  • When using Case Structures, define a default case.
  • Use VI Analyzer to assess the quality the readability of the code.
  • Avoid unnecessary bends in Block Diagram wires.
    • The keyboard shortcut <Ctrl>+<U> can be used to quickly clean up a highlighted object/wire.
    • Avoid using the clean-up shortcut on the entire VI.