T O P I C R E V I E W |
cheyenne |
Posted - 09/29/2005 : 10:16:45 AM Origin Version (Select Help-->About Origin): 7.5 Operating System: Windows XP
I desperately need a labtalk command that extract data from a worksheet to a new one according to the values of a categorical column or to the number of rows. Moreover, It would be of great help to know how to remove in a 120-columns worksheet some columns according to their number, as well as inserting rows starting from the last one of each worksheet.
Thank you very much indeed for you help as usual, in advance!
|
5 L A T E S T R E P L I E S (Newest First) |
cheyenne |
Posted - 10/27/2005 : 10:43:14 AM I managed to solve the problem, but I wonder what I should change in the code to put the data (3 columns) extracted from the "mother" worksheet to another one, just one, where I have a set of 3 columns XYZ for each value of the magnetic field, like:
210 231 562 etc etc 340 871 832 460 821 842 770 651 172 550 551 992 |
cheyenne |
Posted - 10/27/2005 : 08:25:36 AM Thanks Mike, but unfortunately in the "results" worksheet I get only the first raw, from the "mother" worksheet, corresponding to the field I choose, but I have thousands of values corresponding to each field I choose, and I need all of them, and not only the first one, in the resulting worksheets. I tried to solve the problem myself but I never get what i need. Thanks for your piece of advice anyway Mike. |
Mike Buess |
Posted - 10/06/2005 : 1:08:50 PM The following script extracts the values in columns 1, 2 and 3 based on the mag field value in column 3. It asks for a mag field value, creates a worksheet for the results, searches all non-results worksheets for the mag field value and extracts the appropriate data if found.
getn ( ) vv (Enter magnetic field in Tesla); if(vv==0/0) return; for(i=1;i>0;i++) { # generate name for results wks %W=Results$(i); if(exist(%W)==0) break; }; win -t D; win -r %H %W; // rename wks wo -a 1; // add col 3 nn=0; doc -e W { # loop over all wks and skip if name starts with Results if("%[%H,8]"!="Results") { i=list(vv,col(3)); // look for first row that contains specified mag field value, i=0 if not found if( i ) { # copy values to new row in Results wks nn++; %W!cell(nn,1)=%H!cell(i,1); %W!cell(nn,2)=%H!cell(i,2); %W!cell(nn,3)=%H!cell(i,3); }; }; };
Mike Buess Origin WebRing Member |
cheyenne |
Posted - 10/06/2005 : 09:26:30 AM Thank you very much Mike, you're very useful as usual.About the extraction; I often sort huge worksheet according to the integer values of a specific column in the worksheet itself. What I am trying to do is to extract the rows of the worksheet associated with a certain value of this reference column, and put these sub-worksheets in new worksheet, one for each of the values in the reference column. Let's say I have resistivity vs temperature (X-Y), and a third column where there is the magnetic field at which these resistivity data was taken (like 1,2,3,4...9 Tesla for instance).I need to extract the resistivity vs temperature data in 9 different worksheet, according to the 9 possible values of the field, the field column itself included. Thank you very much in advance Mike. |
Mike Buess |
Posted - 09/30/2005 : 1:36:20 PM del wcol(n); // remove the nth column in active wks del %(%H,n); // same thing
set %H wks.nrows+10; // add 10 rows to active wks
Need more details about what you want to extract and to where.
Mike Buess Origin WebRing Member |
|
|