Click here to Skip to main content

chan200uk asked:

Open original thread
Hi, I am working on arrays and I have a problem.I am trying to calculate the difference between data point,Xi, and its predecessor,Xi-1.
For example each element in an array or list needs to be subtracted with the previous element.
 
Series
1
2
4
8
3
3
3
4
2
2
.
.
 
Required output
1
2
4
5
0
0
1
2
0
 
I have tried to use two arrays ...I am using charts but the idea is the same..I tried to seperate the elements but I cant work out. I am stuct.. any example or anything would help.. thanx in advance
 
For i = 0 To Chart1.Series("series1").Points.Count - 1
          temp = Chart1.Series("series1").Points(i).YValues
          xArray(i) = temp(0)
          ListBox1.Items.Add(xArray(i).ToString())
 
      Next
 

      For i = 1 To Chart1.Series("series1").Points.Count - 1
          temp = Chart1.Series("series1").Points(i).YValues
          yArray(i) = temp(0) - temp(i)
          ListBox2.Items.Add(yArray(i).ToString())
          i += 1
      Next
 

Thanks in advance..
Cheers
Tags: VB.NET, list, array

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web01 | 2.8.141015.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100