Author |
Topic  |
|
circumvent
Posts |
Posted - 06/19/2007 : 10:03:14 AM
|
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
|
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 |
 |
|
circumvent
Posts |
Posted - 06/19/2007 : 12:22:14 PM
|
keep one point every three points.
Thanks |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 06/19/2007 : 1:02:57 PM
|
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 |
 |
|
circumvent
Posts |
Posted - 06/19/2007 : 2:15:17 PM
|
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 |
 |
|
Mike Buess
USA
3037 Posts |
|
|
Topic  |
|