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
 Subtract consequent rows
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Neena1695

Canada
117 Posts

Posted - 07/03/2021 :  4:10:40 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello Origin users,



What function can I use to get values in column B? I want to subtract values in each row with the previous row.

Thank you,
Neena

easwar

USA
1965 Posts

Posted - 07/03/2021 :  5:04:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Neena,



Easwar
OriginLab
Go to Top of Page

Neena1695

Canada
117 Posts

Posted - 07/03/2021 :  8:33:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Easwar,

A similar question: What function can I use to get values in column M? Column L is the addition of values in K sequentially from row 1. How can I get output M where the addition is done sequentially from last row to first row?



Many thanks,
Neena
Go to Top of Page

easwar

USA
1965 Posts

Posted - 07/03/2021 :  10:24:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Neena,

With LabTalk, one possible solution is:


You can also use Python in Set Values dialog, such as:


To learn more about using Python functions in Set Values dialog, go here:
https://www.originlab.com/doc/python/tools/Set-Column-Values

Easwar
OriginLab
Go to Top of Page

Neena1695

Canada
117 Posts

Posted - 07/03/2021 :  11:32:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you so much Easwar again!

However, the output I want is not just the reverse of the sum column. But perform the sum from the bottom row and way up to the first row. The output is different (below).



Thanks,
Neena
Go to Top of Page

easwar

USA
1965 Posts

Posted - 07/04/2021 :  08:24:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Neena,

Sorry...

Change the Python function to:

import numpy as np

def revcumsum(y):
    y= np.cumsum(y[::-1])
    return y[::-1]


Change the LabTalk code to:

range rin=1, rout=2;
rout = rin;
colreverse rout;
rout=sum(rout);
colreverse rout;



Easwar
Go to Top of Page

Neena1695

Canada
117 Posts

Posted - 07/04/2021 :  10:56:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you so much Easwar! Origin is a powerful analysis platform!
Go to Top of Page

easwar

USA
1965 Posts

Posted - 07/04/2021 :  11:55:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Neena,

Thank you for the comment on Origin.
Can you share the user story on why you need to compute such reverse cumulative sum?

Best regards,

Easwar
Go to Top of Page

Neena1695

Canada
117 Posts

Posted - 07/06/2021 :  6:31:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar,

I am working with a protein for which I need to look into some properties that are different when reading the protein sequence in the forward and reverse direction. Hence, I needed the sum of input values (property of interest) in the forward and reverse direction.

Regards,
Neena
Go to Top of Page

easwar

USA
1965 Posts

Posted - 07/06/2021 :  8:04:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Neena,

Thank you for the response.

Easwar
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