View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
jmccaski jmccaski is offline
external usenet poster
 
Posts: 4
Default How to extract data from an array

On Jan 31, 1:06*pm, GS wrote:
jmccaski brought next idea :



I have an array with over 21,000 rows. I need to analyze this but have
not been able to get it out in a useful format yet. The data looks
like this:


VarName * *TimeString * * *VarValue
Pos * * * *27.01.2011 12:49:35 * * 32
Pres * * * 27.01.2011 12:49:35 * * -2
Setpt * * *27.01.2011 12:49:35 * * 100
Gain * * * 27.01.2011 12:49:35 * * 1
Int * * * *27.01.2011 12:49:35 * * 10
Pos * * * *27.01.2011 12:49:36 * * 32
Pres * * * 27.01.2011 12:49:36 * * -2
Setpt * * *27.01.2011 12:49:36 * * 100
Pos * * * *27.01.2011 12:49:37 * * 32
Pres * * * 27.01.2011 12:49:37 * * 9
Setpt * * *27.01.2011 12:49:37 * * 100
Pos * * * *27.01.2011 12:49:38 * * 32
Pres * * * 27.01.2011 12:49:38 * * 9
Setpt * * *27.01.2011 12:49:38 * * 100
Pos * * * *27.01.2011 12:49:39 * * 32
Pres * * * 27.01.2011 12:49:39 * * 24
Setpt * * *27.01.2011 12:49:39 * * 100
Pos * * * *27.01.2011 12:49:40 * * 32
Pres * * * 27.01.2011 12:49:40 * * 24
Setpt * * *27.01.2011 12:49:40 * * 100
Gain * * * 27.01.2011 12:49:40 * * 1
Int * * * *27.01.2011 12:49:40 * * 10


I need to extract it into a format something like this in order to
chart it:


TimeString * * * * * * * *Pos *Press Setpt Gain Int
27.01.2011 12:49:35 * * * *32 * * *-2 * * *100 * * * * *1 * *10
27.01.2011 12:49:36 * * * *32 * * *-2 * * *100
27.01.2011 12:49:37 * * * *32 * * *9 * * * 100
27.01.2011 12:49:38 * * * *32 * * *9 * * * 100
27.01.2011 12:49:39 * * * *32 * * *24 * * *100
27.01.2011 12:49:40 * * * *32 * * *24 * * *100 * * * * *1 * *10


Any help would be appreciated. I've burned up a couple of days so far
with little luck.


What's the structure of the array?

Is it something like:

* myArray(0,0)=[VarName]
* myArray(0,1)=TimeString
* myArray(0,2)=VarValue

so that:

* myArray(0,0) = "Pos"
* myArray(1,0) = "Pres"
* myArray(2,0) = "Setpt"
* myArray(3,0) = "Gain"
* myArray(4,0) = "Int"
* myArray(5,0) = "Pos"
* ...and so on

If so then...

To put the values into ColsA:C

* For n = LBound(myArray) To UBound(myArray)
* * Cells(n + 1, 1) = myArray(n,0)
* * Cells(n + 1, 2) = myArray(n,1)
* * Cells(n + 1, 3) = myArray(n,2)
* Next

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


I misspoke calling it an array... it is just three columns of data,
VarName, TimeString and VarValue. I need to extract all the variables
for each time step.