Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: Sep 10, 2008


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Generating and Sorting Numbers in LabVIEW and C

6 ratings | 2.17 out of 5
Print

Downloads

Filename: generatesortupdated.zip
Requirements: View

This example includes code written in both C and LabVIEW that illustrates how to develop an application that generates and sorts an array of numbers. These applications use the O(n^2) Bubble Sort algorithm. Both programs use polling For Loops to allow the user to input instructions.

The LabVIEW program takes advantage of the powerful graphical user interface (GUI) available in LabVIEW. The C example uses the Standard I/O window. A GUI could be created in C using standard C development environmments, but it was not implemented in this example for maximum portability and simplicity of the C code. An executable of similar functionality written in National Instruments LabWindows/CVI C environment is also included with this example to show how the GUI might look in C. Included with the GenerateAndSort VI is the Bubble Sort VI, a subVI that implements the sorting in a manner comparable to C. Also included with this example is the BubbleSort-easier VI, which shows an easier way to implement a bubble sort in LabVIEW using built-in VIs.

This example was written in conjunction with the "Can LabVIEW C? - Example 1: Basic Structures and Methods" document linked below, which compares functionality between C and LabVIEW.

Requirements:

  • LabVIEW 8.0 or later or LabVIEW Evaluation Software is required to view and run the LabVIEW examples.
  • Any C compiler is required to view and execute the C code. If you do not have a C compiler, you can download the LabWindows/CVI Evaluation Software to run the C code and to try the premium C environment for measurement and automation applications. At a minimum, the LabWindows/CVI Run Time Engine is required to run the CVI executable.

 

Related Links:
Download LabVIEW evaluation
LabWindows/CVI Evaluation Software
LabWindows/CVI Run Time Engine
Can LabVIEW C? - Example 1: Basic Structures and Methods Whitepaper
Can LabVIEW C? Overview Whitepaper

 

Requirements


Filename: generatesortupdated.zip

Software Requirements


Application Software: LabVIEW Professional Development System 8.0
Language(s): LabVIEW, C
Additional Software: Visual C++

 
6 ratings | 2.17 out of 5
Print

Reader Comments | Submit a comment »

Operating system restrictions
The sample program implicitly assumes MS Windows operating systems. It will be helpful to add this to the requirements in the text.
- Viktor Schlosser, Institut fuer Materialphysik. viktor.schlosser@univie.ac.at - Aug 11, 2005

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).