Example Code

Calculate the Mean Value of Each AI Channel from DAQmx Read Multiple Channels

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.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview

This example demonstrates how to display the acquired data from each AI channel and calculate the average of them. 

Description

The DAQmx Read is a polymorphic function which can be used to read multiple AI channels at once. We can then display each AI channel information by spitting the combined signal. More data analysis can be added after the DAQmx Read loop for example calculating the mean value and performing a FFT.

Requirements

Software

  • LabVIEW 2010 or compatible
  • DAQmx 9.1.5 or compatible

Hardware

  • Most NI DAQ hardware that supports analog input

Steps to Implement or Execute Code

  1. Enter how many samples you want to calculate the mean value from;
  2. Choose 4 channels that you want to read;
  3. Run the VI long enough to allow enough data to be acquired;
  4. Stop the VI and check the mean values in the “The final mean value of AI0-AI3” array.

Additional Information or References


Block Diagram.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.

Contributors