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
 Merging Channels from ADC measurement
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

RaphBilder

4 Posts

Posted - 06/01/2022 :  04:28:37 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,
I am trying to use Origin to display the data I measured in a column plot.
I want to merge some channels of my ADC measurement (meaning that I want to add up the values for a certain number of channels and display them as one column).
How can I do that?
I also uploaded the data.

Origin Ver. and Service Release: 9.9.5.167
Operating System: Windows 10

Edited by - RaphBilder on 06/01/2022 04:33:05 AM

Shirley_GZ

China
Posts

Posted - 06/02/2022 :  01:55:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi RaphBilder,

We didn't see any data in this post. Please upload it again and give us the download link.

Generally, if you just want to add up multiple dataset, you can import them into different columns and then use Set Column Values tool.
https://www.originlab.com/doc/Origin-Help/Wks-SetColVal-QuickStart

Thanks,
Shirley

Originlab Technical Service Team
Go to Top of Page

RaphBilder

4 Posts

Posted - 06/02/2022 :  2:26:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
I've uploaded it in Google Drive now. Here's the link: https://drive.google.com/file/d/1A3JTIW7qxBQVv6haP9J3VoDsB1fk22BS/view?usp=sharing

I found that tool but I couldn't get it to do what I want.

I basically want to have sum of the first 5 values of the data in the first cell, the sum of the second 5 values in the second cell and so on.
In the data provided that would work out to
0
0
0
0
0
0
1
1
8
12
and so on.

But not with only with 5 but with an odd variable x.
Then I can calculate the middle of each data point with:
z = (x+1)/2 + (y-1) * x
with y as the current cell.

So then the sum needs to reach from z-(x+1)/2 to z+(x+1)/2.

I also found the total function for calculating a sum, but I total(B[z-(x+1)/2 : z+(x+1)/2]) (with the data in Column B) didn't seem to work.

Edit: Changed column to cell


Edited by - RaphBilder on 06/03/2022 04:26:51 AM
Go to Top of Page

cpyang

USA
1380 Posts

Posted - 06/02/2022 :  4:11:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You said second 5 values in second column? But looks like you want to use column A as source and put result into column B with sum of each 5 values right?

CP
Go to Top of Page

YimingChen

1108 Posts

Posted - 06/02/2022 :  4:26:11 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can use Python function in Origin to calculate group sum in col(B). See below:

import numpy as np

def group_sum(x, win):
    '''F:Fi'''
    return np.add.reduceat(x, np.arange(0, len(x), win))





James
Go to Top of Page

RaphBilder

4 Posts

Posted - 06/03/2022 :  04:30:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
thank you very much for your help.
I tried using your code but my results are different. It just puts a -- in every cell. What could be the reason for that?
In addition Origin changes the , in py.group_sum(A, 5) to a . (py.group_sum(A. 5)) when I close the window and reopen it.
Could that be connected?
Go to Top of Page

cpyang

USA
1380 Posts

Posted - 06/03/2022 :  11:43:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
use ; instead,

py.group_sum(A;5)


Looks like your PC is using "," as decimal separator. The Python or Labtalk part will still use comma, but the formula part we need to allow for comma as decimal so must use ; to separator function arguments.

CP
Go to Top of Page

RaphBilder

4 Posts

Posted - 06/03/2022 :  11:56:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That works!
Thank you very much!
Go to Top of Page

snowli

USA
1081 Posts

Posted - 06/23/2022 :  4:49:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

We just released Origin 2022b sr1 which will auto convert , to ; for this case so u don't need to manually change it to ;

Please feel free to download sr1 installer and choose Repair to upgrade your Origin.
https://www.originlab.com/restricted/demo_download/DLRequest.aspx?rq=dl&d=1&s=E

Thanks, Snow
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