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
 sum over col(A)[3:6]
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

EigenGoofy

64 Posts

Posted - 10/06/2011 :  1:20:43 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.0pro
Operating System: vista

I wanna calculate the sum from row 3 to row 6 on the column A on the active work sheet. The follow code does not work,

int i1 = 3;
int i2 = 6;
range a = col(A)[$(i1):$(i2)];
sum(a) =

it will return on the Classic script window:
SUM(a)=--


Thank you!

By the way, if I wanna calculate the sum from row 1 to the end on the column A on the active work sheet, how can I do this by mouse instead of writting code please?

Hideo Fujii

USA
1582 Posts

Posted - 10/06/2011 :  2:36:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi EigenGoofy,

sum(...) is a function to create various statistical properties like sum.N, sum.Total, sum.Mean, etc. (Try sum.=<ENTER> in Script window to see all properties.) Therefore the way like following should work:
int i1 = 3;
int i2 = 6;
range a = col(A)[$(i1):$(i2)];
sum(a);
mytotal=sum.total;


--Hideo Fujii
OriginLab
Go to Top of Page

EigenGoofy

64 Posts

Posted - 10/08/2011 :  08:43:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by Hideo Fujii

Hi EigenGoofy,

sum(...) is a function to create various statistical properties like sum.N, sum.Total, sum.Mean, etc. (Try sum.=<ENTER> in Script window to see all properties.) Therefore the way like following should work:
int i1 = 3;
int i2 = 6;
range a = col(A)[$(i1):$(i2)];
sum(a);
mytotal=sum.total;


--Hideo Fujii
OriginLab



I restarted my Origin, in the first time that I tried your code, it returned "MYTOTAL=--". Then I changed to

range a2 = col(A)[$(i1):$(i2)];
sum(a2);
mytotal=sum.total;

It returned the correct value.

Then I changed back by useing "a" for the range again. It returned the correct value again.

Although I was confused by its odd behavior, my question was finally solved. Thank you very much, Hideo!
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