({.+i.@>:@({:-{.)) t
3 4 5 6 7 8 9 10
(1,~(2-~/\])t)#m
131 131 132 132 131 131 131 130
Robert Raschke schreef:
> Hi,
>
> I'm have two arrays, one with timestamps (in seconds, monotonically
> ascending) and the other with data at those times. For example,
>
> t =: 3 5 7 10
> m =: 131 132 131 130
>
> I feel that in order to do some sensible plotting, averaging, etc. I
> would want to convert the above into a time series representation:
>
> tt =: 3 4 5 6 7 8 9 10
> tm =: 131 131 132 132 131 131 131 130
>
> I have a rough idea on how to get from t to tt (taking all pair
> intervals and filling out with the missing numbers). Something along
> the lines of
>
> boxfill =: < @ ({. + i. @ - @ (-/))
> bboxfill =: <@fill
> expand =: ([: ; 2&(ubfill\)) , {:
> expand t
> 3 4 5 6 7 8 9 10
>
> Although I feel like that's a bit complicated and I'm missing
> something easy.
>
> That leaves me wondering how to get from m to tm? Any ideas are
> gratefully received.
>
> Robby
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm