You can also use rle() to generate a list of counts and values:
pdl> p $t [90 90 100 80 90 90 80 90 90 100] pdl> p $t(1:)-$t(0:-2) [0 10 -20 10 0 -10 10 0 10] pdl> $del = $t(1:)-$t(0:-2) pdl> p $del [0 10 -20 10 0 -10 10 0 10] pdl> p $del->qsort [-20 -10 0 0 0 10 10 10 10] pdl> p $del->qsort->rle [1 1 3 4 0 0 0 0 0] [-20 -10 0 10 0 0 0 0 0]
If you have pgplot, you can also do a bin hist $del to get a histogram plot of the values. --Chris On 5/4/2012 6:17 PM, Scott Penrose wrote:
I have a piddle with time steps, e.g. print $t; [ 100, 150, 200, 249, 300 ]; The data is really long and obviously the example above is made up. Anyway I want to calculate the number between and calculate, so from the data above I would have 50 = 2 49 = 1 51 = 1 The main reason I am doing this is to make sure that my measurements are on the window (in this case 50 ms) and how many are not. Currently I just did it by hand, keeping the last value and iterating through all the data in a loop. But it didn't feel very PDL way. What is the better way? Ta Scott
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
