Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: Compare fields in a file

by Not_a_Number (Parson)
on Feb 10, 2009 at 19:19 UTC ( #742856=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Compare fields in a file
in thread Compare fields in a file

If I add a few events to the input, this breaks. Try it with these data:

2550,531,66,10-12-2007 07:03:08.069,2 2549,529,62,10-12-2007 07:03:08.151,1 2550,531,66,10-12-2007 07:03:09.069,1 2549,529,62,10-12-2007 07:03:09.151,2 2550,531,66,10-12-2007 07:03:10.001,6 2550,531,66,10-12-2007 07:03:11.099,7

The output:

2550,531,66,10-12-2007 07:03:08.069,2 2549,529,62,10-12-2007 07:03:09.151,2 2550,531,66,10-12-2007 07:03:10.001,6 2550,531,66,10-12-2007 07:03:11.099,7

Ignore. I misread the specs.


Comment on Re^4: Compare fields in a file
Select or Download Code
Re^5: Compare fields in a file
by johngg (Abbot) on Feb 10, 2009 at 19:57 UTC

    Perhaps I've misunderstood the requirement but that output looks as I would have expected.

    • Two events at time 07:03:08, event with amplitude 2 chosen.

    • Two events at time 07:03:09, event with amplitude 2 chosen.

    • A single event at time 07:03:10, the only event (with amplitude 6) chosen.

    • A single event at time 07:03:11, the only event (with amplitude 7) chosen.

    So far as I can tell, that satisfies the requirement "I'd like to keep only the largest magnitude within each second" to the letter.

    Perhaps you could explain further in which way it is "broken."

    Cheers,

    JohnGG

      Perhaps I've misunderstood the requirement (...)

      Oops, no, it seems that it's me who completely misread the OP's requirements.

      Sorry :(

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://742856]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-07-11 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (218 votes), past polls