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
 All Forums
 Origin Forum
 Origin Forum
 Average of a part of a column

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
bvg15 Posted - 10/21/2015 : 9:55:35 PM
Origin Ver. and Service Release (Select Help-->About Origin): 8
Operating System: Win 7

Hello,

I want to get an average of a set of values in a column and save the average value in a cell within the same data sheet. I tried the syntax suggested in the link below.

http://www.originlab.com/forum/topic.asp?TOPIC_ID=18781

I tried using the same values to test whether the script works but the average value displayed is 0 instead of the expected average value. What could be the problem? Also, is it possible do the same but for several sets of values in the same column using the same syntax? Finally, is it possible to run the same syntax on several data sheets simultaneously?

Thanks for your help.
2   L A T E S T    R E P L I E S    (Newest First)
bvg15 Posted - 10/26/2015 : 11:03:42 PM
Thank you.
Shirley_GZ Posted - 10/22/2015 : 02:37:37 AM
Hi,
Please run the script lines below to calculate the average values for every 5 rows of col(A) in current worksheet:
loop(ii,1,4)
{
jj=ii*5-4;
range rr=col(A)[jj:jj+4];
sum(rr);
mymean=sum.mean;
col(B)[ii]=mymean;
}

To run the same syntax on all worksheets in current project simultaneously, you can use doc –e command. See the example below:
Doc –e LB
{
range rr=col(A)[1:5];
sum(rr);
mymean=sum.mean;
col(B)[1]=mymean;
}


http://www.originlab.com/doc/LabTalk/ref/Document-cmd#-e_object_.7Bscript.7D.3B_Execute_the_given_script_for_all_objects

Originlab Technical Service Team

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000