reading ASCII Data [message #15013] |
Tue, 13 April 1999 00:00  |
Mirko
Messages: 20 Registered: April 1999
|
Junior Member |
|
|
Hello
We have ASCII files (floats) with a different number of lines and
different number of data in each line. The data was generated by a mass
spectrometer software under Win 3.11. Each measurement line ends with
'0D'xb instead of '0D'xb and '0A'xb. Is there a way to find the END OF
LINE with an IDL function (like EOF) because each line starts with some
"header information" which has to be skipped before the measured data
starts.
How can you handle a variable number of floats?
Cheers
Mirko
|
|
|
Re: reading ASCII Data [message #15113 is a reply to message #15013] |
Tue, 20 April 1999 00:00  |
meron
Messages: 51 Registered: July 1995
|
Member |
|
|
In article <371CD852.1E35776B@io.harvard.edu>, Martin Schultz <mgs@io.harvard.edu> writes:
> David Foster wrote:
>>
>> [...] I thought
>> it'd be trivial using IDL's STR_SEP(), but you can't get rid of
>> the extra space characters easily (it gets confused when two
>> delimiting characters are next to each-other...dreadful programming!).
>>
>
> looks a little clumsy but can be done (as long as they are really only
> spaces
> seperating your data records):
>
> tokens = str_sep( strcompress( strtrim( line, 2 ) ), ' ' )
>
> (maybe this would be worth its own function, e.g. strstrip)
>
Well, you can use my STRPARSE which is already 8 years old and still
better than STR_SEP.
Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
|
|
|
Re: reading ASCII Data [message #15114 is a reply to message #15013] |
Tue, 20 April 1999 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
David Foster wrote:
>
> [...] I thought
> it'd be trivial using IDL's STR_SEP(), but you can't get rid of
> the extra space characters easily (it gets confused when two
> delimiting characters are next to each-other...dreadful programming!).
>
looks a little clumsy but can be done (as long as they are really only
spaces
seperating your data records):
tokens = str_sep( strcompress( strtrim( line, 2 ) ), ' ' )
(maybe this would be worth its own function, e.g. strstrip)
Regards,
Martin.
--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
|
|
|