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 for Programming
 LabTalk Forum
 INI File to Worksheet

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
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

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