The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Averaging Worksheets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tonyv

Germany
Posts

Posted - 09/29/2006 :  08:39:49 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

Could you tell me how to average Worksheets in a program?

Thank you

erica-cn

China
Posts

Posted - 09/30/2006 :  02:51:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page

zachary_origin

China
Posts

Posted - 09/30/2006 :  04:13:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/30/2006 :  08:28:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000