Forum: Ruby dealing with piecewise arrays

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9e952fcaa85f3170d41b3c6cbb990894?d=identicon&s=25 Yaj Bhattacharya (Guest)
on 2009-03-17 13:40
(Received via mailing list)
I want to perform the following in Ruby, could someone please help
translate this pseudocode?

1. Read in a time series in a columnar format from an external file
(covered elsewhere in this forum, including for completeness)
        given data triplets: time, value, error

2. Check for discontinuities in data:
                   if  [time(i+1) - time(i)] > some_value, then
                            store this piece of triplet array and give
it a address (say piece_1)
                   continue reading until another discontinuity is
encountered
                            store the new piece of triplet array with
new address (piece_2)
                   until end of file

3. Write out each piece as a separate file with meaningful filenames
based on the time of the array above, so the file written for piece_1
would be called "time(i)_time(i+n).dat" where the time array is a
continuous array without gaps (no gaps greater than some_value deduced
in step 2).

Thanks in advance
Yaj
This topic is locked and can not be replied to.