Karl wrote:
> Am 06.11.2013 04:01, schrieb Dom:
>> Hello,
>>
>> I would like to use the stats function, I started with stats.dem which
>> works fine with the data the demo was designed for, but when I use my
>> data, it doesn't work, my data looks like this:
>>
>> 07:41:52 7.8 111.3 359.5 1069.8 119.1 1429.3
>> 07:41:53 89.1 251.3 9015.6 2265.7 340.4 11281.3
>> 07:41:54 27.4 94.2 9958.1 1101.8 121.6 11059.9
>>
>> I need to find when the maximum value of column 6 and 7 occur (time
>> stamp). I have tried to adapt the code in stats.dem with no luck.
>>
>
> What did you try to do this?
>
> I think it just isn´t implemented at the time. If you do
>
> set xdata time
> stats "data.dat"
>
> gnuplot says
>
> "Stats command not available in timedata mode"
True. But it's possible to interpret time data using generic
string commands. I prefer this to timedata mode in any case.
# This converts the time string in column COL to a number of seconds
intime(COL) = strptime("%H:%M:%S",strcol(COL))
# This finds correlation of time (seconds) in col 1 with the value in col 6
stats 'data' using (intime(1)):6
# This prints a time, not necessarily unique, at which the
# maximum value in column 6 occurred
print strftime("%H:%M:%S", STATS_pos_max_y)
That is, I think, what you wanted. Note that you don't get any
warning if that same maximum time occurs on multiple lines.
Ethan