Example Code

Area of a Plane Region

Code and Documents

Attachment

Download All

Overview

Main_Area.vi runs a GUI from which you can plot the graph of two Polynomial Functions, compute the area of the region between them, and save the generated graph in a .png image file.  This example illustrates how to manipulate strings, how to use a Run-Time menu, how to evaluate a function, how to use control reference, and some tips about of GUI design. 

Description

The Main_Area.vi is a GUI which uses custom menu options and references to other VIs in the attached zip file to create a smooth interface for plotting polynomial functions and calculating the area between them.  You can see the methodology used to implement this by opening the block diagram of the various VIs contained within the attached .zip file.  The menu.rtm file also shows how to create a custom menu in a top level GUI VI.

http://decibel.ni.com/content/servlet/JiveServlet/download/1240-4-1299/Snapshot%20Area%20of%20Plane%20Region.PNG

To access the block diagram of Main_Area.vi, open the VI, and before pressing "Aceptar Datos" on the splash screen that opens up, press Ctrl + "." to stop the VI.  Once the VI is stopped, press Ctrl + E to access the block diagram.

Steps to Implement or Execute Code

  1. Download the attached .zip file to your computer.
  2. Open Main_Area.vi
  3. Enter the desired coefficients (A, B, C, D, and E) of your Polynomial Function, and the range you would like your function to be drawn (X inicial and X Final).
  4. Press Enter or the Aceptar Datos button.
  5. To change the area being calculated, modify the "X inicial" and "X final" values in Main_Area.vi
  6. To change the polynonial functions being plotted or the range that they are drawn, press Ctrl + F.
  7. To save the plot to a .png file, press Ctrl + G.
  8. To read about the author or about the institution, press Ctrl + H.
  9. To exit the program, press Ctrl + X.

Requirements

Software

LabVIEW Development Environment 8.2 or later

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**

____________________________________________
Carlos Calderón Córdova, Ing.
Universidad Técnica Particular de Loja
Grupo de Control, Automatización y Robótica
Escuela de Electrónica y Telecomunicaciones
Phone: (+593) 7-2570275 ext. 2650
Cell: 098663798
____________________________________________

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

Comments
cacalderon
Member
Member
on

I present them my gallery of snapshots of applications developed in
LabVIEW.
I thank to some members of LabVIEW-user groups for their contributions with regard to the design of GUIs.

LabVIEW GUI Gallery Link: http://forums.lavag.org/gallery-user8339-album77.html



____________________________________________
Carlos Calderón Córdova, Ing.
Universidad Técnica Particular de Loja
Grupo de Control, Automatización y Robótica
Escuela de Electrónica y Telecomunicaciones
Phone: (+593) 7-2570275 ext. 2650
Cell: 098663798
____________________________________________
Todd S.
NI Employee (retired)
on

Your GUIs are so smooth! This really is great code!

Todd S.
LabVIEW Community Manager
National Instruments
Contributors