Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Extra Data Points on Measurement Studio Graph

Primary Software: Measurement Studio>>Standard Edition (Starter Kit)
Primary Software Version: 6.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem: While using Microsoft Visual Basic to plot data points on a Measurement Studio graph, I keep getting extra data points at the end of my graph. I plotted the data in Microsoft Excel to make sure that it is not corrupted and everything is fine. Why are these extra data points appearing?

Solution: This behavior is a result of declaring an array to contain more points than the number of data points actually stored. When elements in an array are uninitialized, their default values are used. For example, numeric values use 0 and string data values use " ".

With Visual Basic arrays, the index of each dimension is zero-based, which means the array ranges from 0 through its upper bound. The code, Dim y(25) as Double, creates an array of 26 elements that will range from y(0)y(25).

Therefore, when creating an array of n elements, define the array size to be n-1.

Refer to the Attachments section for demonstrations of this concept and refer to the Related Links section for more information about array size declaration.

Related Links:
MSDN Library: Array Size Declaration for Visual Basic Users


Attachments:


VB 6.0.zipVB.NET.zip


Report Date: 06/28/2006
Last Updated: 04/16/2007
Document ID: 3YRF53T3

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit