T O P I C R E V I E W |
tonyv |
Posted - 09/29/2006 : 08:39:49 AM Hi,
Could you tell me how to average Worksheets in a program?
Thank you
|
3 L A T E S T R E P L I E S (Newest First) |
Mike Buess |
Posted - 09/30/2006 : 08:28:40 AM Hi Tony,
If you are asking how to create a worksheet with columns that are the averages of corresponding columns in existing worksheets then the following LabTalk script will average all worksheets in the active project folder. Of course existing worksheets must all have the same number of columns and rows.
%P=%H; // save name of active wks wo -d; // duplicate active wks %W=%H; // save name of new wks ncols=wks.ncols; // number of columns nn=1; doc -ef W { if("%H"!="%W" && "%H"!="%P") { loop(i,1,ncols) {%(%W,i) += %(%H,i)}; nn++; // count worksheets }; }; loop(i,1,ncols) {%(%W,i) /= nn};
...An OriginC version of the operation is given near the end of this topic.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 09/30/2006 08:59:46 AM |
zachary_origin |
Posted - 09/30/2006 : 04:13:17 AM Hi Tonya,
Do you mean you want to program to do the average? Do you really need average the whole worksheet? In Origin, there is no direct averaging method for the whole worksheet because by design the data in different columns worksheet have different designation, saying X,Y, so that it is not reasonable to average them. For each column (dataset), you can use Average script in LabTalk and Datasum function in OriginC to average the data. If the data are stored in a matrix, matrixbase::GetMean method can be used. You can search these keywords in Origin:Programming.
Zachary OriginLab Technical Services.
Edited by - zachary_origin on 09/30/2006 04:35:36 AM |
erica-cn |
Posted - 09/30/2006 : 02:51:58 AM hi Tonya Vitova
I am sorry that don't know what you really want to do. Would you please tell me what you mean about "average Worksheets in a program " Thank you
Erica Shang OriginLab Technical support
|
|
|