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 for Programming
 LabTalk Forum
 Average of filtered 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
achu6393 Posted - 03/14/2017 : 12:02:54 PM
I am trying to get average of a column which is already filtered by particular ranges. I can achieve this through options. For example, apply a filter range for col(A) between 0-15 and then if I select the col(b) I can view the average of the filtered average in the status bar. But can I write a Labtalk script to get these averages an store in a separate worksheet?

Origin Ver. and Service Release: 9.3
Operating System: Win7

such coding! much wow!
3   L A T E S T    R E P L I E S    (Newest First)
snowli Posted - 03/15/2017 : 10:05:38 AM
Hello,

there is a system variable @GHM that controls ignore hidden rows or not.
In 2016, it's 0, which will not ignore hidden rows. But in Origin 2017, we changed default to -1 which is follow worksheet settings (which is ignore by default).

So in Origin 2016, if you set it to 1, it will ignore hidden rows.
You can change the default value of system variables in Tools: System Variables dialog.

http://www.originlab.com/doc/Origin-Help/System-Variable-Dialog


Origin 2017 also improved this so more analysis tools will handle hidden rows.

Thanks, Snow
cpyang Posted - 03/15/2017 : 04:51:17 AM
It seems that 2016 did not handled filtered value in LabTalk functions but 2017 works fine.

Assuming you have col(A) with a filter enabled, then

mean(col(A))=;

will dump the correct result consistent with status bar in 2017 but not in 2016 (9.3)

CP
yuki_wu Posted - 03/15/2017 : 02:59:18 AM
Hi,

Labtalk can certainly do this, for example:

string strCond$ = "col(A) > 0 && col(A) < 15";
ave = averageif(col(B),strCond$);
[book1]sheet2!Cell(1,1)=ave;

Know more about averageif:
http://www.originlab.com/doc/LabTalk/ref/Averageif-func

Regards,
Yuki
OriginLab

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