Example Code

Three Piece Length Optimization

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

 

A Solution to finding the combination of lengths necessary to cover a given distance

Description

This is one of many solutions for this puzzle. This VI allows the user to assign a length to three elements and also a total distance that is desired. After running the VI, the output tells the user how many of each piece is necessary to cover the distance and also the remaining distance that cannot be covered with the available lengths.

 

Original Programmer: 2Shanez

Hardware and Software Requirements

LabVIEW Full Development System 2016 or compatible

Steps to Implement or Execute Code

1. Enter values for the three different elements

2. Enter total distance to be covered

3. Run VI

Additional Information or References

The lengths for Large, Medium, and Small must decrease in value. Small cannot be larger than Medium and Medium cannot be larger than Large.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors