|
From: Ethan M. <merritt@u.washington.edu> - 2007-05-14 18:15:44
|
On Saturday 12 May 2007 07:13, pl...@pi... wrote:
> My other problem is that the code snip I posted seems to be correctly
> calculating the areas of the increamental trapezoidal segements but fails
> to add the existing value of my area variable.
>
>
> area=0; started=0;prev_x=0;prev_y=0;
> add_aug(x,y)=assign("area",(started)?\
> area + (x-prev_x)*(y-prev_y)/2.0
> + 0.0*assign("prev_x",x) + 0.0*assign("prev_y",y) \
> :( 0.0*assign("started",1)
> + 0.0*assign("prev_x",x) + 0.0*assign("prev_y",y) ) \
> );
>
>
> plot datafile using
> 1:(add_aug(strptime("%H:%M",stringcolumn(1))/3600*2,P( Th4($3-2.0)
> -(Th7($5)-0.52) ))) axes x1y2 with lines s f t "aug" \
>
>
>
> So referencing area inside assign("area", ) seems to return zero, whereas
> the other calls to assign() work and references to the other variables
> inside assign() produces expected results.
>
> Can you confirm that bug and hopefully correct it?
Too complicated for my poor brain.
Please try to reduce this to a much simpler test script
that demonstrates an error.
The obvious test:
sum(x) = assign("sum",x+sum)
plot <foo> using 1:($2+0*sum($2))
seems to work just fine
--
Ethan A Merritt Courier Deliveries: 1959 NE Pacific
Dept of Biochemistry
Health Sciences Building
University of Washington - Seattle WA 98195-7742
|