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
 Swapping multiple columns

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
Biotec12 Posted - 02/26/2015 : 11:35:26 AM
Origin Ver. OriginPro 8.6.0 (64-bit) Sr3
serial number: SF8T5-3089-7902432

Dear all,

I am trying to swap several columns using

for (ii = 1; ii < 326; ii=ii+2)
{colswap (ii, ii+1); }

However it is replying

#User Abort!

anyone know why?
In addition how to change all x columns to y and all ys to x?

Thanks in advance
5   L A T E S T    R E P L I E S    (Newest First)
lic24 Posted - 03/07/2015 : 03:30:43 AM
Is swapping is possible for multiple rows

[URL=http://www.lic24.in]my personal blog[/URL]
Biotec12 Posted - 03/05/2015 : 03:53:30 AM

I modified your script to rename all x to y and all y to x

for( ii = 1 ; ii <= wks.ncols ; ii=ii+1)
{if (wks.col$(ii).type == 4)
wks.col$(ii).type = 1;
else wks.col$(ii).type = 4;
}
Biotec12 Posted - 02/26/2015 : 2:20:02 PM
Dear Hideo Fujii dear Meili thanks for answers.

This code by Meili solved the issue
for( ii = 1 ; ii <= wks.ncols-1; ii+=2)
{worksheet -s ii 0 ii+1 0;
colswap;
}
meili_yang Posted - 02/26/2015 : 1:19:10 PM
Hi,

Maybe try this to swap between every two columns:
for( ii = 1 ; ii <= wks.ncols-1; ii+=2)
{worksheet -s ii 0 ii+1 0;
colswap;
}

And this to change for example all x columns to y.
for( ii = 1 ; ii <= wks.ncols ; ii+=0)
{if (wks.col$(ii).type == 4)
wks.col$(ii).type = 1;
else ii+1;
}
Column type: 1 = Y, 2 = disregard, 3 = Y Error, 4 = X, 5 = Label, 6 = Z, and 7 = X Error

Meili

Meili
OriginLab Tech Support
Hideo Fujii Posted - 02/26/2015 : 1:12:52 PM
Hi Biotec12,

This should work:
for (ii = 1; ii < 326; ii=ii+2)
 {colswap (%(ii), %(ii+1)); }
%(...) is needed to let the LabTalk interpreter resolve the variable as the argument in the command.

--Hideo Fujii
OriginLab

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