Does anyone have a good way of matching times? Here I have an example they happen to be somewhat in order. c contains 35 lines that need to be matched with a and b. There is an excess of 5 lines in c compared to a+b so d contains 5 dummies.
The times need not be sorted like this and they may be missing in either direction. The task is to get a best match which gives the least time difference and get the indexes for c that give the best match for a+b There are a lot of fields in each line but only connection between them is the time field. In this example the time difference between the equipment is roughly 19 minutes NB. -----------------head a=:".;._2 (0 : 0) 11 00 29 000 11 00 38 000 11 00 44 000 11 00 52 000 11 01 00 000 11 03 20 000 11 03 28 000 11 03 35 000 11 03 43 000 11 03 51 000 11 05 09 000 11 05 17 000 11 05 25 000 11 05 32 000 11 05 40 000 ) NB. -------------------- abdomen b=:".;._2 (0 : 0) 11 11 04 000 11 11 11 000 11 11 19 000 11 11 27 000 11 11 34 000 11 12 46 000 11 12 54 000 11 13 02 000 11 13 10 000 11 13 17 000 11 14 36 000 11 14 44 000 11 14 52 000 11 15 00 000 11 15 07 000 ) NB. ----------------- dcm c=:".;._2 (0 : 0) 11 16 47 450 11 16 55 150 11 17 02 950 11 17 10 600 11 17 18 300 11 19 25 350 11 19 33 200 11 19 41 000 11 19 48 700 11 19 56 450 11 22 16 250 11 22 24 050 11 22 31 750 11 22 39 500 11 22 47 200 11 24 05 650 11 24 13 450 11 24 21 150 11 24 28 850 11 24 36 600 11 29 59 550 11 30 07 350 11 30 15 050 11 30 22 750 11 30 30 450 11 31 42 600 11 31 50 400 11 31 58 100 11 32 05 850 11 32 13 550 11 33 32 400 11 33 40 200 11 33 47 900 11 33 55 600 11 34 03 300 ) NB. ------------------ auka d=:".;._2 (0 : 0) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) NB. ------------------- example calculations - the last one gives the correct lines hooked together c-a,b,d 24 60 60 1000 #:((24 60 60 1000 #.c)-24 60 60 1000 #.a,b,d) c-~a,b,d 24 60 60 1000 #:((24 60 60 1000 #.c)-~24 60 60 1000 #.a,b,d) c-d,a,b 24 60 60 1000 #:((24 60 60 1000 #.c)-24 60 60 1000 #.d,a,b) -- Björn Helgason, Verkfræðingur Fugl&Fiskur ehf, Þerneyjarsund 23, Box 127 801 Grímsnes ,t-póst: [EMAIL PROTECTED] Skype: gosiminn, gsm: +3546985532 Landslags og skrúðgarðagerð, gröfuþjónusta http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .-----------------------------------. ,' .\ / | Með léttri lund verður | ,--' _,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. | `-----------------------------------' | ) | (\_ _/) (`-. '--.) (='.'=) `. )----' (")_(")
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
