Author |
Topic  |
|
autopilot
26 Posts |
Posted - 03/05/2009 : 07:44:20 AM
|
Origin Ver. and Service Release (Select Help-->About Origin):7.5 SR6 Operating System:winXPpro
Hello,
I would like to import ASCII files with a LabTalk script. Multiple ASCII files (extension is .csv) should be imported to new COLUMNS of the selected table.
All files located are in folders: D:\data\1D:\data\1\2D:\data\1\2\3 Also I did not find how to create new folders: data\1, data\1\2, data\1\2\3.
|
|
Shirley_GZ
China
Posts |
Posted - 03/06/2009 : 12:36:44 AM
|
Hi Autopilot,
Please try the open -a command. For example,
%A=D:\data\1\2\3\test.csv; open -a %A;
As for Creating new folder, I have no idea of what you mean. Please get me more details.
Shirley
Originlab Technical Service Team |
Edited by - Shirley_GZ on 03/06/2009 12:46:27 AM |
 |
|
autopilot
26 Posts |
Posted - 03/06/2009 : 04:50:16 AM
|
Hello,
Thank you very much for the advise and help.
I have tried open -a filename, it works fine for 1 file, but how do I keep importing data as new columns from many files?
Concerning the new folder, simply lets say my data files are stored in the folder D:\labdataNow with the help of Project Explorer I could manually create new Folder called "labdata" and manually import my files into worksheet created inside that folder. How to do this with Labtalk (automated)?
I really appreciate your help. |
 |
|
autopilot
26 Posts |
Posted - 03/09/2009 : 09:30:05 AM
|
Let me better explain the issue:
lets say I have two data files: test1.dat test2.dat
Commands: %A=D:\test1.dat; open -a %A; %A=D:\test2.dat; open -a %A; will simply overwrite the data in the table with data from test2. How do I import test2 data in the new column of the same table?
Thanks for your advise. |
 |
|
Deanna
China
Posts |
Posted - 03/09/2009 : 11:33:15 PM
|
quote:
Commands: %A=D:\test1.dat; open -a %A; %A=D:\test2.dat; open -a %A;
Hi,
When I activated a worksheet in Origin 7.5 SR6 and ran the script, the second file did not erase the data in the first file. The data in the second file, instead, was appended to the worksheet (into new columns). Are there any special settings related to the worksheet?
Deanna OriginLab Technical Services |
 |
|
Deanna
China
Posts |
Posted - 03/09/2009 : 11:40:04 PM
|
quote: Originally posted by autopilot Concerning the new folder, simply lets say my data files are stored in the folder D:\labdataNow with the help of Project Explorer I could manually create new Folder called "labdata" and manually import my files into worksheet created inside that folder. How to do this with Labtalk (automated)?
I really appreciate your help.
To create a folder in your Origin project, you can used pe_mkdir. You can search in the programming help for its usage.
Deanna OriginLab Technical Services |
 |
|
greg
USA
1379 Posts |
Posted - 03/10/2009 : 10:22:51 AM
|
Here is code which creates a new folder off the root and adds a new workbook:
pe_mkdir \labdata; // make a new folder pe_cd \labdata; // change to the new folder newbook; // start a new workbook
The open command has three switches (among others) that control the import:
open -w <filename>; // replace existing data open -a <filename>; // add data as new columns open -ar <filename>; // add data as new rows
|
 |
|
autopilot
26 Posts |
Posted - 03/10/2009 : 11:50:43 AM
|
quote:
Hi,
When I activated a worksheet in Origin 7.5 SR6 and ran the script, the second file did not erase the data in the first file. The data in the second file, instead, was appended to the worksheet (into new columns). Are there any special settings related to the worksheet?
Deanna OriginLab Technical Services
Deanna, sorry, indeed you are right, I do not know how could I have made a mistake...
Guys, thanks a lot, your suggestions works great. I didn't find these PE_ commands before, thanks for help. Since you so great help, I have the last question then: What command can read the origin file path and file/directory names in that path? |
 |
|
autopilot
26 Posts |
Posted - 03/10/2009 : 12:03:11 PM
|
quote:
What command can read the origin file path and file/directory names in that path?
Sorry, again I am being not clear: I need to find the path where the data files are stored, NOT the path inside the origin's project explorer (I know this can be obtained using "pe_get_path" command).
Appreciate your help. |
 |
|
|
Topic  |
|