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 for Programming
 LabTalk Forum
 How to cull data in origin
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

circumvent

Posts

Posted - 06/19/2007 :  10:03:14 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5E
Operating System:XP

Hi,

Does anyone know how to cull data in Origin? By either labtalk or Origin C?

Basically, I want my dataset culled every 2 points in this first 500 points and culled every 3 points in the last 400 points. Is there any easy way to do it?

Currently I am using a loop with "make -d dataset".

Thanks,

Jinbo

Mike Buess

USA
3037 Posts

Posted - 06/19/2007 :  11:01:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Basically, I want my dataset culled every 2 points in this first 500 points and culled every 3 points in the last 400 points.
Doesn't matter for first part but 2nd part needs clarification. Does "cull every 3 points" mean "delete 1 of every 3 points" or "keep 1 of every 3 points"?

Mike Buess
Origin WebRing Member
Go to Top of Page

circumvent

Posts

Posted - 06/19/2007 :  12:22:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
keep one point every three points.

Thanks
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/19/2007 :  1:02:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Download the following Origin C file and add it to CodeBuilder's workspace as explained here.

http://www.nmrtools.com/files/Decimate.c

The file contains two functions (Decimate and AppendRowsFromWks) which are used in the LabTalk script below. Although the script might look complicated it should be considerably faster than the loop you are currently using. It assumes that the starting number of points is more than 500+400=900 (i.e., there is a middle part of the file that you are not culling.) The script changes the starting worksheet so you might want to duplicate first.

%W=%H; // save name of active wks
nrows=wks.maxrows; // how many rows?
wo -d; // duplicate
%P=%H; // save name
set %P -er 500; // truncate at 500 rows
decimate %P 1 2; // delete all but rows 1,3,5,...
win -a %W; // restore %W
wo -d; // duplicate
%Q=%H; // save name
mark -d col(1) -b 1 -e (nrows-400); // delete all but last 400 rows
decimate %Q 1 3; // delete all but rows 1,4,7,...
win -a %W; // restore %W
set %W -er (nrows-400); // delete last 400 rows
mark -d col(1) -b 1 -e 500; // delete 1st 500 rows
AppendRowsFromWks %P %W; // append %W to %P
AppendRowsFromWks %P %Q; // append %Q to %P
win -cd %W; // delete %W
win -cd %Q; // delete %Q
win -r %P %W; // rename %P as original wks

Mike Buess
Origin WebRing Member
Go to Top of Page

circumvent

Posts

Posted - 06/19/2007 :  2:15:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
many thanks to Mike.

By the way,
Where did you find all these interesting codes like decimate.c?

I was searching "http://www.nmrtools.com/files/" but it doesn't work.

Is there any website that I can download Origin C files?

Thanks
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/19/2007 :  3:16:11 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Well, www.nmrtools.com is my home page and most of its subfolders are not searchable. I wrote Decimate.c and you can read about its functions (and other tips) here...

http://www.nmrtools.com/labtalk/index.html

There are many more examples and tools available on OriginLab's site, for example...

http://www.originlab.com/index.aspx?s=8&lm=243
http://www.originlab.com/fileexchange/

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 06/19/2007 3:16:40 PM
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