Example Code

Array as a Circular Buffer

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

Create a user-defined circular buffer


Description

This example creates an array of user specified size that is treated as a circular buffer.  After the array is filled, the index moves to the front of the array and begins replacing elements.


Requirements

LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code:

  1. Specify the size of the array
  2. Run the code

Additional Information or References:

 

Array as a Circular Buffer FP.png

 

Array as a Circular Buffer sn.png


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

Alex Person
NI-RIO Product Support Engineer
National Instruments

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

Comments
Todd S.
NI Employee (retired)
on

Thanks for posting!

Todd S.
LabVIEW Community Manager
National Instruments
Thoric
Trusted Enthusiast Trusted Enthusiast
Trusted Enthusiast
on

You could also use the integer divide instead of a case statement for your cyclic iteration counter, and hence do away with the second shift register. As seen in: http://decibel.ni.com/content/docs/DOC-3734

Thoric (CLA, CLED, CTD and LabVIEW Champion)