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
 Averaging last 20 points in several columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AOjuva

11 Posts

Posted - 04/27/2022 :  01:20:04 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2022 SR1
Operating System: Win 11

Hi, I have multiple Y columns with varying lenghts (separated series from a long measurement). Usually I have to manually check the values and mask some of the points at the end, where the measurement value is erraneous (e.g. sensor in air between samples), and then I choose the last ~20 points, average them and get a single data point from that sample.

The masking will have to be done by hand, but is there an easy way to select the last ~20 points using cell formula? I can also delete the erraneous points instead of masking them, if it is needed.

AmandaLu

439 Posts

Posted - 04/27/2022 :  02:31:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please run following script in the Command Window:

doc -e DY{
range rcol = %c;
int nn = rcol.nrows;
range rr = rcol[$(nn-19):$(nn)];
del rr;
}

This will delete the last 20 rows for each Y column in the current worksheet.

Thanks,
Amanda
OriginLab Technical Service

Go to Top of Page

AOjuva

11 Posts

Posted - 04/27/2022 :  02:39:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Sorry for being unclear. I need those last 20 cells, after I have masked the tail, for my analysis. See an example attached. :)

Go to Top of Page

AmandaLu

439 Posts

Posted - 04/27/2022 :  04:45:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

If you want to keep last 20 rows, please try:

doc -e DY{
range rcol = %c;
int nn = rcol.nrows;
range rr = rcol[1:$(nn-20)];
del rr;
}

Thanks,
Amanda
OriginLab Technical Service
Go to Top of Page

AOjuva

11 Posts

Posted - 04/27/2022 :  04:53:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, that works when I delete the obsolete data at the end first. :)

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