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
 Export XY columns to each ASCII file

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
RobDU Posted - 02/04/2018 : 12:35:53 PM
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro2016 (64-bit) Sr2 b9.3.2.303
Operating System: Windows Server 2012 R2 Standard

Hi,

I would like to export data from a worksheet. This worksheet has more than 150 columns, 1st is X the following are Y. I want to export each Y column together with the X column each to a separate *.dat file. i.e.
Filename1 X Y1
Filename2 X Y2

How can I do this? Is there a possibility?

Thank you in advance.

Rob
4   L A T E S T    R E P L I E S    (Newest First)
snowli Posted - 02/06/2018 : 11:13:57 AM
Hi Rob,

In Origin 2018, we have increased the maximum number of sheets per workook to 1024.


Also try if the following code works for you.
//Don't highlight any column in workbook;
wks.colsel(1,1); //select 1st column;
for (ii=2;ii<=wks.ncols;ii++) //start loop for 2nd column to last column)
{
wks.colsel(ii,1); //select iith column
expASC path:="D:\temp\waterfall$(ii-1).dat" select:=1; //export selected columns
wks.colsel(ii,0); //unselect iith column
}

Thanks, Snow
yuki_wu Posted - 02/05/2018 : 9:16:48 PM
Hi Rob,

The number of columns is restricted by the maximum number of sheets in a workbook. In general, the maximum number of sheets in a workbook is 255. If the number of columns is larger than the limitation number, you can split the original worksheet at first, for example:
X, Y1, Y2… Y250
X, Y1, Y2… Y125 and X, Y125, Y126… Y250

To export the file with the long name of Y column:
expASC path:="C:\Users\yuki\Documents\OriginLab\User Files\" + col(B)[L]$+ ".dat";


Regards,
Yuki
OriginLab
RobDU Posted - 02/05/2018 : 4:11:37 PM
Hello Yuki,

thank you for your fast help. So I tried it, but I am getting if the column number is higher than 200 an Attention! window with the following syntax: Unable to add any more layers/sheets to this graph/book. while splitting the columns. Is there maybe another solution without opening sheets?

Is it possible to change the file names in the export function to the Y-column long name? It is needed cause this long name is the time information of my experiment.

Thank you.

best regards

Rob
yuki_wu Posted - 02/05/2018 : 01:07:23 AM
Hi Rob,

I think you can try LabTalk script. For example, I stored the data in [Book1]Sheet1!, then I can:
1. Select Window: Script Window form menu
2. Copy and paste the script into Script Window
//Activate the workbook that has 150 columns
win -a Book1;
//Activate the worksheet that has 150 columns
page.active = 1;
//Split worksheet
wsplit mode:=col col:=1;
//Loop over every worksheet
doc -e LW{
	//Copy column X to the active worksheet
	colcopy irng:=[%H]1!Col(1) orng:=!Col(2);
	//Swap column 1 and column 2
	colswap (1,2);
	//Export worksheet to the specified path and name it with the name of the active worksheet
	expASC path:="C:\Users\yuki\Documents\OriginLab\User Files\" + page.active$ + ".dat";
}

4. Select the script to highlight it
5. Click Enter key to run the script

Note that you should rewrite the path to specify where the dat file should be exported.

Regards,
Yuki
OriginLab

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