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 for Programming
 LabTalk Forum
 Conditional extraction of cells in a new column

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
fabiolucared Posted - 01/11/2017 : 03:51:38 AM
Origin Ver. and Service Release (Select Help-->About Origin): 9.4
Operating System: Windows 10

Hi,
I managed to import a txt file with the impasc function.
I am now trying to make evaluation on the data. A typical file looks like this:
T I Z N
2 5 1 5
1 5 1 1
6 5 1 3
2 5 2 4
3 5 3 8
4 5 3 9
6 5 4 7

I would like to split the worksheet according to the Z number, therefore:

if(Z==1)
copy the values of T and N in a new sheet in col(A) and col(B) giving them the names T1 and N1.

if(Z==2)
copy the values of T and N in the same sheet, now in col(C) and col(D) giving them the names T2 and N2.

And so on for Z=3 and Z=4. The number of rows is not always the same, therefore I need a conditional.

I tried with the wxt function but this always copied all the columns (also the ones I do not want) and it created always a new sheet instead of placing them in new columns of the same sheet.

A nice way which I could do manually was the "Worksheet query" where the conditions (for example Z==1) can be assigned to a column and can be recalculated everytime.

Is it possible to make this (conditional query) with a LabTalk script (since often Z>100)?

Thanks in advance for every advice.
Fabio

1   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 01/11/2017 : 04:46:48 AM
Hi Fabio,

You can try the X-Function wunstackcol.

I will assume that you have already imported your file into Origin worksheet:
1.Active Sheet1 where you imported your data into


2.Run the script

wunstackcol irng1:=[Book3]Sheet1!(1,4) irng2:=col(3) pos:=append;

3.A worksheet will be created.


More info about wunstackcol can be read here:
http://www.originlab.com/doc/X-Function/ref/wunstackcol

Hope it helps.

Regards,
Yuki
OriginLab

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