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
 Remove points from selected range
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peter.cook

UK
356 Posts

Posted - 08/23/2004 :  11:42:04 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I would like to be able to manually draw a region around some data points on a graph and then remove all the values from within...anyone have any thoughts as to how this could done?

Transparent would be required.
Rectangle would do (.. free draw of loop would be nice but I suspect more complicated.)

Thanks,

Cheers,

Pete

Mike Buess

USA
3037 Posts

Posted - 08/23/2004 :  2:25:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Pete,

It would probably be easiest to use a rectangle and create it in advance. Set it's properties through normal GUI and save it as an OGO file...

draw -n Rect -f save %YRect.ogo;

You could use a 2-button toolbar. 1st button draws the rectangle. User positions and sizes it. 2nd button removes the points inside.

[Button1]
draw -n Rect -f read %YRect.ogo;
Rect.x=(X2-X1)/2; // center it horizontally
Rect.y=(Y2-Y1)/2; // center it vertically

[Button2]
xx1=Rect.x-Rect.dx/2; // x value at left
xx2=Rect.x+Rect.dx/2; // x value at right
ii1=xindex1(xx1,%C); // index of left-most point inside rect
ii2=xindex(xx2,%C); // index of right-most point inside
yy1=Rect.y-Rect.dy/2; // y value at bottom
yy2=Rect.y+Rect.dy/2; // y value at top
for(ii=ii2;ii>=ii1;ii--) {
yy=%C[ii]; // delete the row if y value is inside rect (next line)
if(yy>yy1 && yy<yy2) mark -d %C -b ii -e ii;
};

...Corrections in red.

There might be a more efficient way to remove the rows but that should work.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/23/2004 2:34:41 PM

Edited by - Mike Buess on 08/24/2004 10:48:10 AM
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 08/23/2004 :  3:17:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Be aware, however one of the quirks of the mark -d LT-command

mark -d dataset [range]
Delete elements from dataset. If dataset is in a worksheet, this command deletes the specified rows from the worksheet

If there are many Y-datasets in a single worksheet, it will do the same for all datasets in that worksheet. This could be either very convenient or quite awkward depending on what one wants ...
Go to Top of Page

peter.cook

UK
356 Posts

Posted - 08/24/2004 :  09:31:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

Thanks for this..I was thinking along these lines but hadn't considered your approach of using a rectangle created in advance.
This is useful!

Ruthven..cheers for the reminder. Inpractice i always tend to set to missing values rather than delete in order to keep integrity in layouts etc and allow for easier 'return' of data in our applications.

Cheers,

Pete

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 08/24/2004 :  10:34:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Pete,

If you prefer to use missing values you can replace the mark command with %C[ii]=0/0;

Also, there are errors in the Button2 script. Replace xvalue() with xindex() and xvalue1() with xindex1(). Arguments are the same as before.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/24/2004 10:37:53 AM
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