Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

breaking up lists into intervals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23074] breaking up lists into intervals
  • From: Matt.Johnson at autolivasp.com
  • Date: Sat, 15 Apr 2000 03:00:30 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com


Dear Mathgroup:

I have many large datasets of {x,y,z} data that I wish to break into small data
sets based on the value of x.  For example, the x value ranges from 0 to 100 and
I want ot break up the data into 20 groups, from 0-5, 5-10, 10-15, etc.  There
will be an unequal number of data points in each interval.  I have written a
routine based on several Do loops to do this and it works satisfactorily.
However, I would think that there is a way to eliminate from the data set the
points that have already been placed in their appropriate intervals, or a
routine that would "place" the point in the appropriate group, only having to go
through the datasets once.  Either of these options would speed up the process.
Currently the routine goes through each complete dataset as many times as there
are intervals created.  Here is the current code:

Do[Do[Do[
     If[ i-0.5 di<=dataset[j][[k,1]]<=i+0.5 di,
     AppendTo[group[j,i],dataset[j][[k]] ]],
     {k, Length[dataset[j]]}],
     {i, imin, imax, di}], {j,jmax}]

There are j datasets with k points in each dataset.  i serves as the index for
the intervals, according to the x value, with an interval size of di.
It creates (imax-imin)/di intervals in each dataset.

Thanks for any help

Matt Johnson




  • Prev by Date: Re: Needs[] and <<
  • Next by Date: Re: NestWhile
  • Previous by thread: Re: Re: Vector Union
  • Next by thread: Re: breaking up lists into intervals