Thursday, July 12, 2007

TDerivative for excel

The following script will take the derivative of all the plotted datasets in the active graph window. It assumes that these datasets all share the same X values. It then stores the derivative datasets in one new worksheet, named TDerivative.

%W=%H;  //store the name of the active window
layer -c; //count stores the number of plotted datasets and %Z stores concatenated names of datasets
GetEnumWks TDerivative; //open new wks and name it TDerivative
copy -x %[%Z,#1] %(%H,2); //copy datasets to the new wks
deriv %(%H,2); //take the derivative of these datasets
wks.col2.label$="Derivative of %[%Z,#1]";
deriv %(%H,ii+1); 
wks.col$(ii+1).label$="Derivative of %[%Z,#ii]";

No comments: