Reading string array [message #11242] |
Thu, 19 March 1998 00:00  |
Neil Winrow
Messages: 18 Registered: July 1997
|
Junior Member |
|
|
I have the following problem:
openr,10,filnam
dataTitle = make_array(7,/string)
for i=1,30 do readf,10,a ;read the header information
readf,10,dataTitle
close,10
The piece of code above is supposed to read over the header information
in the data file, and read in the following column titles into
dataTitle:
X Y Z FLUX MAXL MAXM IMIN
But this doesn't work, is there some obvious mistake I'm making with my
code.
Thanks
Neil
|
|
|
Re: Reading string array [message #11362 is a reply to message #11242] |
Fri, 20 March 1998 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Alex Schuster wrote:
>
> Neil Winrow wrote:
>
>> in the data file, and read in the following column titles into
>> dataTitle:
>>
>> X Y Z FLUX MAXL MAXM IMIN
>>
>
> IDL has to know how long the individual strings are. You can use
> READF, 10, dataTitle, format='(7A7)'
> assuming that each string is seven characters long.
>
.. or you can use STR_SEP to get your header "tokens" out of one header
line. Your problem sounds to me as if you may want to try my readdata
routine which you find on the web page indicated below.
Martin.
--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ -------
|
|
|