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
 INI File to Worksheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

wallacej

UK
Posts

Posted - 02/24/2005 :  06:26:07 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 02/24/2005 :  08:09:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

wallacej

UK
Posts

Posted - 02/24/2005 :  09:56:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 02/24/2005 :  10:25:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

wallacej

UK
Posts

Posted - 02/24/2005 :  12:04:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank You Mike, i'll give that a go
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