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
 Find maximum in a column, delete following data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Thymes

Germany
2 Posts

Posted - 10/19/2012 :  02:55:06 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello everyone,

I hope someone is able to help me.

I have 6 columns displaying force data. Now, what I would like to do is find the maximum value within each column and delete all following data points. But I want to keep the data before the maximum is reached.
Any help would be great!

Thymes


Origin Ver. and Service Release: OriginPro 8.5.0 G SR1
Operating System: Win 7

greg

USA
1378 Posts

Posted - 10/19/2012 :  11:43:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The following script takes into account that there may be repeat maximums and uses the last maximum:

loop(ii,1,wks.ncols)
{
range ra = $(ii);
dataset ds;
stats ra;
vfind ix:=ra value:=stats.max ox:=ds;
ra.SetSize(ds[ds.GetSize()]);
}
doc -uw;

If you only want the first, then use this:
loop(ii,1,wks.ncols)
{
range ra = $(ii);
dataset ds;
stats ra;
vfind ix:=ra value:=stats.max ox:=ds;
ra.SetSize(ds[1]);
}
doc -uw;

In the GUI, this amounts to using statistics on columns to find the maximum value, then using Edit : Find to locate the maximum and selecting and deleting all following rows.
Go to Top of Page

Thymes

Germany
2 Posts

Posted - 10/22/2012 :  03:10:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you!

Your script works perfect
This is really a big help!

More thanks and greetings from Germany
Thymes
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