T O P I C R E V I E W |
OndrejMM |
Posted - 06/15/2009 : 08:51:16 AM Hi Guys,
I have data in the YXXXX format, and i would need to do linear fitting X1Y, X2Y, .... etc.,... I've decided to achieve this by modifying the XYYYY script,... very simple that i will always move X column to the first position, see the script below,... but it doesn't work!? I don't see what is wrong there,... I'm not getting any error message but it doesn't fit and it finishes after the first "ii",... many thanks in advance, Ondrej
newsheet name:=FitLines c:=1;// add new sheet to hold fit lines range aa = 1!;//1st sheet, assume we start with just one data sheet range bb = FitLines!;// the newly added sheet called "FitLines" bb.ncols = aa.ncols;// Add new columns in FitLines sheet
loop(ii,2,aa.ncols) { page.active=1; colmove rng:=wcol(ii) operation:=0; range dd = 1!(1,$(ii)); ftlr i:=dd o:=FitLines!(1, wcol(ii)); slopes[ii-1] = fitlr.b;//ii-1 because we loop from 2 intercepts[ii-1] = fitlr.a; }; |
2 L A T E S T R E P L I E S (Newest First) |
OndrejMM |
Posted - 06/16/2009 : 7:01:55 PM thank you Deanna,... |
Deanna |
Posted - 06/16/2009 : 01:12:59 AM Hi,
It is not necessary to move the columns. You can just construct suitable ranges and then use these ranges when calling the X-Function.
For example, the loop can be rewritten as:
loop(ii,2,aa.ncols) { range dd = 1!(wcol(ii), 1); fitlr iy:=dd oy:=FitLines!(1, wcol(ii)); slopes[ii-1] = fitlr.b;//ii-1 because we loop from 2 intercepts[ii-1] = fitlr.a; };
Deanna OriginLab Technical Services |
|
|