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
 All Forums
 Origin Forum
 Origin Forum
 unzip, truncate, rezip

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
juannim Posted - 04/26/2007 : 12:33:08 PM
Origin Version (Select Help-->About Origin): 7.5
Operating System:xp
I need to sort the first six (of ten) values of each column in the worksheet. The values are actually "zipped" (apparently as in the FFT output). I want to sort according to the odd rows, maintaining the association, and only shuffling the first six rows in the column. I can't get my values to copy back after sorting. What am I doing wrong? I would love to just "zip" back with the copy -z command, but can't figure out how to delete the blank data. Please help. Jonathan
[sort]
worksheet -c tsorta;
worksheet -c tsortb;//make space to sort
loop(i, 1, wks.ncols-3) {
copy -u wcol(i) col(tsorta) col(tsortb);//unzip the ten values of column i
mark -m %h_tsorta -b 4 -e 5;
mark -m %h_tsortb -b 4 -e 5;//eliminate last two cells in each of the unzipped-to columns
alpha=wks.ncols-1
beta=wks.ncols
sort -cd alpha beta %h_tsorta; //sort data
loop(ii,1,3) {
wcol(i)[2*ii-1]=col(tsorta)[ii];
wcol(i)[2*ii]=col(tsortb)[ii];//re-zip the sorted, non-blank values back to original columns
};
};
2   L A T E S T    R E P L I E S    (Newest First)
juannim Posted - 04/30/2007 : 2:04:26 PM
Mike,
I finally made my script work (rigth after I got your reply). It seems that I only had to manipulate the lengths of the columns for it to work. Jonathan
worksheet -c tsorta;
worksheet -c tsortb;//make space to sort
loop(i, 1, wks.ncols-3) {
copy -u wcol(i) col(tsorta) col(tsortb);//unzip the ten values of column i
set col(tsorta) -es 3;
set col(tsortb) -es 3;
sort -cd (wks.ncols-1) (wks.ncols) %h_tsorta;//sort data
set col(tsorta) -es 5;
set col(tsortb) -es 5;
copy -z col(tsorta) col(tsortb) wcol(i);
//loop(ii,1,3) {
// cell(2*ii-1,i)=col(tsorta)[ii];
// cell(2*ii,i)=col(tsortb)[ii];//re-zip the sorted, non-blank values back to original columns
};
};
Mike Buess Posted - 04/26/2007 : 2:11:12 PM
Hi Jonathan,

Use the sort object instead of command because you can sort a range of rows for easier rezipping.

%W=%H; // save name of active wks
win -t D; /create new wks
%P=%H; // save its name
loop(ii,1,%W!wks.ncols) {
copy -u %(%W,ii) %(%P,1) %(%P,2); // unzip to %P
sort.wksName$=%P; // wks name
sort.c1=0; // sort all columns
sort.r1=1; // start with row 1
sort.r2=3; // stop with row 3
sort.cname1$=D: A; // sort descending w.r.t. col A
sort.wks(); // perform the sort
copy -z %(%P,1) %(%P,2) %(%W,ii); // rezip to %W
};
win -cd %P; // close sorting wks

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000