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

Home » Public Forums » archive » Is there a better way???
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Is there a better way??? [message #77989] Tue, 11 October 2011 14:30
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
Hi All,

I have some data files with an unknown number of columns with unknown
labels (as in I don't know in advance of readinf each file what they
will contain). I find working with IDL structures much clearer than
anonymous multiple dimensional arrays, so this is my a fragment from
my solution to constructing an array of a structure to hold the data:

tags = <strarr of the column labels>
nrows = <int derived after reading in data to temporary strarr line by
line>

command = 'data_struct= {'
for i=0,n_elements(keys)-1 do command += ','+tags[i]+':0.'
command +='}'
execute(command)
data = replicate(data_struct,nrows)

Then I fill data using by looping over rows and columns using the data.
(j) structure interface.

This feels like an awful hack, and has the limitiation that it can
only be run once a session as I can't work out how to specify the name
of the structure (since replicate can't be convinced to interpret a
string as the name of a structure).

I wrote a Hash implementation that I use for this kind of thing myself
(we use IDL 7.1 around these here parts) but for code that my
colleagues will use I'm trying to make the outputs as simple as
possible as custom objects are not used much and in any case the
syntax is clumsy.

Any ideas?
[Message index]
 
Read Message
Previous Topic: Coyote Programs Screw-Up
Next Topic: Re: Is there a better way???

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

Current Time: Wed Oct 08 18:03:50 PDT 2025

Total time taken to generate the page: 0.00373 seconds