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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Conditional extraction of cells in a new column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

fabiolucared

Switzerland
1 Posts

Posted - 01/11/2017 :  03:51:38 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

yuki_wu

896 Posts

Posted - 01/11/2017 :  04:46:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000