Example Code

Separate an Array Into Even and Odd Values using LabVIEW

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
This code creates an array of 20 random integers, and then separates these into arrays that are even and odd, respectively

 
Description
Here is a brief description of the example:

This program uses auto indexing to run a for loop for each value in the array.

From there, it uses a quotient and remainder to check to see if the current integer is even or odd.

At that point, it uses the build array function to add the value to their respective array, even or odd.

 

Requirements

  1. LabVIEW 2015 (or compatible)


Steps to Implement or Execute Code

  1. Download the VI
  2. Run the VI.
  3. And see the even and odd arrays display on the indicators
  4. Removing the first for loop, and creating an array input, it should be relatively easy to change this into a subVI for regular usage.

Additional Information or References

VI Snippet

Even Odd Separator 2015 NIVerified.png 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

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