Create new arrays from series of subsequent integers in an existing array [message #48828] |
Mon, 22 May 2006 15:10 |
vorticitywolfe
Messages: 19 Registered: January 2006
|
Junior Member |
|
|
Hello,
I have been trying to average components of a time series when they
meet certain criteria.
For example,
I have values in which I use a where statement to specify the critera
criteria=where(time lt 1000)
and I get an array returned which looks like this
data=[0,1,2,3,4,6,8,9,10]
Now, given this array, I would like to specify individual arrays for
any "block" of subsequent numbers with size greater than three.
for this array it would look like this
a=[0,1,2,3,4]
b=[8,9,10]
I tried using the complement keyword in the where statement to put the
null values into an array and try to subscript my way through the
answer
where(-------,complement=q)
result=data[0:Q(0)-1]
result1=[Q(0):Q(1)]
that turned out to be quite messy especially since I am using multiple
files which all have a different "patterns of three or more"
I've messed around with for loops and if statements, but again I have
to change those for each individual file. It would be nice to know a
technique which could accomplish what I am trying to do:
find series of subsequent integers in an array to make multiple new
arrays.
This seems like a simple problem, but I haven't been able to figure it
out. Maybe I'm overlooking something... Any help would be appreciated!
Thank you in advance!
Jon
|
|
|