Example Code

Logging Data apart from Zero

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

Coding that exemplifies how to log all data different from zero.

 

Description

Run the program, adjusting the value in the control. All results but 0 will be logged. You can adjust the timer value on the block diagram to set how often you want to log data. To log data only above 0.01, change this to 0.01.. etc. You can build from this example to fit your application needs.

 

Requirements

LabVIEW 2012 or compatible

 

Steps to Implement or Execute Code
1. Run the VI.
2. Change the control value.
3. Stop the execution with the Stop Button.
4. Search the file and look at the values written.

 

Additional Information or References

 Snippet.png

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

Many thanks for using the NI forums and I look forward to your reply.

Kind regards

David

Applications Engineer
National Instruments UK

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

Comments
Rod42
Active Participant
Active Participant
on

Not quite.

The selector in a case statement can only be a boolean, string, integer or enumerated type. Notice that the selector is coloured blue and has a red dot showing that your double has been coerced to an integer. The coercion is by rounding, so as written it will log any value above 0,5

One way to achieve the result you seek is by doing a test on the value and using the boolean of the result as the case selector.

Tariff Impact Update Learn more