comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » READ_ASCII - accessing data from structures
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: read_ascii [message #41992 is a reply to message #41754] Thu, 09 December 2004 05:52 Go to previous messageGo to previous message
Benjamin Tupper is currently offline  Benjamin Tupper
Messages: 1
Registered: December 2004
Junior Member
Rick Towler wrote:

>
>> The problem is that sometimes the array is contained in field01,
>> sometimes in field01.
>
>
>> How come it varies ?
>
>
> You mean "field1" and "field01".
>
> When confronted with less than 10 fields, READ_ASCII will return
> field1-field9, when you have more than 10, field01-field99.
>
> It is unfortunate that READ_ASCII behaves this way but David's
> suggestion of addressing the structure by tag index instead of tag name
> will solve your problem.
>

Hi,

You could define the names of the fields using ASCII_TEMPLATE before
calling READ_ASCII. You can define the template without using
ASCII_TEMPLATE - a little study of the structure returned by
ASCII_TEMPLATE should help.

Alternatively, you could modify READ_ASCII (call it something else,
though, like MY_READ_ASCII). You can force the routine to always use N
digits in the field names by modifying the following line (line 874 in
my version) ....

digits_str = $
strtrim(string(strlen(strtrim(string(fieldCountUse),2))),2)

to something like this...

my_dig_len = fieldCountUse > 2
digits_str = $
strtrim(string(strlen(strtrim(string(my_dig_len),2))),2)



On a related note, I have drifted away from treating columnated ASCII
data files as nColumns of vectors. Instead, I treat them as vectors of
structures where each row is a record and each column is a field of the
record. This works fine for flatly organized data and I find a vector
of structures MUCH easier to manage in IDL than a structure of vectors.
If you are interested seeing my version of READ_ASCII then shoot me an
email.

Cheers,
Ben
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Flip Matrix
Next Topic: number of decimals?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 25 04:14:09 PDT 2025

Total time taken to generate the page: 0.16177 seconds