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
 Origin Forum
 Subtract consequent rows

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
Neena1695 Posted - 07/03/2021 : 4:10:40 PM
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
9   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 07/06/2021 : 8:04:29 PM
Hi Neena,

Thank you for the response.

Easwar
Neena1695 Posted - 07/06/2021 : 6:31:14 PM
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
easwar Posted - 07/04/2021 : 11:55:28 AM
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
Neena1695 Posted - 07/04/2021 : 10:56:27 AM
Thank you so much Easwar! Origin is a powerful analysis platform!
easwar Posted - 07/04/2021 : 08:24:23 AM
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
Neena1695 Posted - 07/03/2021 : 11:32:36 PM
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
easwar Posted - 07/03/2021 : 10:24:57 PM
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
Neena1695 Posted - 07/03/2021 : 8:33:25 PM
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
easwar Posted - 07/03/2021 : 5:04:34 PM
Hi Neena,



Easwar
OriginLab

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