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
 Generating accumulated data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

yt47106

Sweden
Posts

Posted - 04/12/2010 :  07:15:16 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.0 SR5
Operating System:XP

Hi,

what is the easiest way to generate a new dataset, col(New) containing a continous accumulation of another dataset, col(A).
Each row in col(New) should be the sum of corresponding row in col(A),[ii], added the previously row in col(New), [ii]-1,

Regards, Bjorn

Penn

China
644 Posts

Posted - 04/13/2010 :  02:42:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Bjorn,

You can use the Setting Column Values dialog and LabTalk script to do that. Copy and paste the following script to the Before Formula Scripts box of the Set Values dialog.

for(ii=1; ii<=wks.nrows; ii++)
{
    if(ii==1)
        col(New)[1] = col(A)[1];
    else
        col(New)[$(ii)] = col(A)[$(ii)] + col(New)[$(ii-1)];
}


Penn
OriginLab Technical Services
Go to Top of Page

easwar

USA
1964 Posts

Posted - 04/14/2010 :  5:07:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Bjorn,

You can simply use the sum() function:

1> add the result/New column
2> bring up set values dialog on the result/new column and enter
sum(col(a))
in the edit box and press OK

The sum() function and other functions are available from the F(x) menu in the Set Values dialog, sum is under Statistics category.

Note that you can then also set recalculate to auto so if source data changes the result will automatically update.

Easwar
OriginLab
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