Example Code

Numeric Division Error Check & Validation 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 VI demonstrates how you can divide two numbers, and check for Infinite (inf) or not a number (NaN) errors before using the result in your calling VI.

 
Description

This VI first take two inputs (divisor and dividend) and divides one by the other to get a quotient, then compares the quotient and checks if it is infinity or not a number, and finally displays an error if it is equal to infinity or not a number and displays a message informing the user if the error is caused by either the quotient being equal to inf or NaN.

Use the VI as a subVI, or use it directly. You can modify this subVI to not do the division itself within the subVI, but instead just take a single numeric input and do the logic on that value - i.e. taking out Numeric Two, the division function, and Result.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Select the inputs for Numeric One and Numeric Two.
  2. Run the VI and it will inform the user if an error has occurred.

 

Additional Information or References
VI Snippet

009.png

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

Regards,


Imtiaz Chowdhury
Project Manager
Green Running / Austin Consultants

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

Comments
RJ_15
Member
Member
on

Nice