From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Take the Nth Sample of Data from an Array

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 example will take a 1D array and then pull out the 20th sample of data from that array, creating a new array with the filtered data.  A possible use case would be if you collected more data than you need and would like to filter the data by only taking the nth sample of the data already generated.


Description
Within this code the first For loop generates a 1000 element array that counts from 0-1000.  If you already have an array you can replace the For Loop with your array data.

The second For loop then generates the new array if it is on the 20th sample.  The 20 constants can be changed for what Nth sample you would like to take is.  The program will then take that data point and send it to a new array.

 
Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Open " Build Array From The 20th Sample 2012 NIVerified.vi"
  2. Run the program

 

Additional Information or References
VI Block Diagram

 5-153.png

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

Regards,

M. Whitaker
ni.com/support

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