| T O P I C R E V I E W |
| wallacej |
Posted - 02/24/2005 : 06:26:07 AM Origin Version (7.5): Operating System:Win2k
I have some data in a text file. I would like to retrieve the values and put them into a worksheet for plotting.
The text file layout is currently set to that of an INI file so I can use the ini.getstr command for value retrieval.
I would like to know if there is an easier way to put the values into a worksheet before I start using loops and the above command etc.
I can set the text file to be of any layout but it is desireable to have headings etc as opposed to raw data. If necessary I could generate two data files with one being raw data in a format that Origin can interpret.
Thank You |
| 4 L A T E S T R E P L I E S (Newest First) |
| wallacej |
Posted - 02/24/2005 : 12:04:37 PM Thank You Mike, i'll give that a go |
| Mike Buess |
Posted - 02/24/2005 : 10:25:22 AM There are two ways to go in LabTalk.
1) Create a custom wks template with the proper ASCII Options (e.g., number of columns, column separator, number of lines to skip (header size), etc.). Then import with these commands...
win -t D MyTemplate; // create a wks from your template %Z=file path\name; open -w %Z; // import file
2) Use the Ascimport object's properties and methods, e.g., ...
win -t D; // create wks from default template Ascimport.GetSettings(); // get its ASCII import settings Ascimport.numcolumns=4; // reset # of columns Ascimport.delimiter=3; // columns are separated by spaces Ascimport.headerlines=16; // 16 lines in header Ascimport.FileName$=file path\name; Ascimport.WriteSettings(); // save settings to wks Ascimport.Import(); // import file
Look for Ascimport details in LabTalk's Object Reference. (A similar method is available in Origin C.)
Mike Buess Origin WebRing Member |
| wallacej |
Posted - 02/24/2005 : 09:56:13 AM Thanks Mike
Thats true. I think thats the way that i'll go. Can you point me in the right direction on how to read in columnar data? |
| Mike Buess |
Posted - 02/24/2005 : 08:09:49 AM I think you'll find that reading data values in a loop will be painfully slow. Origin's standard method of importing columnar data is much faster. But there's no reason you can't combine an ini-type header and columnar data in the same file.
[Header] param1=value1 param2=value2 param3=value3 . . .
[Data] x y z x y z x y z . . .
Mike Buess Origin WebRing Member |