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

falagar

2 Posts

Posted - 02/28/2011 :  08:16:16 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I have a set of data that includes columns with data and columns with "markers". The data is the summation of measurement values and the marker value A shows at which point in the column the summation starts again from 0. Then there is in the marker column a marker value B which shows that a set of summations is finished.

I need to take all the summation values (marked with A) of one set (end marker B) and sum them up. As there a a lot sets of summations I do not want to do it "by hand". Is there a script based solution?

(I know that if the summations occured in defined rows I could simply say: sum up column G from 1 to 5 and 6 to 10, but it isnt that easy.)

(G)(H)
1 x
3 x
4 A
1 x
2 A
1 x
2 x
4 B
1 x
3 x
.......
Need: sum (if H includes A or B take value from G, but only until B, then start again from 0)


Thanks !

greg

USA
1378 Posts

Posted - 02/28/2011 :  10:19:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
range rad = 1;
range ras = 2;
total = 0;
loop(ii,1,rad.GetSize())
{
if(ras[ii]$=="A") total += rad[ii];
if(ras[ii]$=="B")
{
total += rad[ii];
col(3)[ii] = total;
total = 0;
}
}
Go to Top of Page

falagar

2 Posts

Posted - 03/02/2011 :  03:46:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks alot !
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