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

Home » Public Forums » archive » Re: Help with reading structure from file
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: Help with reading structure from file [message #23805 is a reply to message #23724] Sun, 18 February 2001 14:04 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Surendar Jeyadev wrote:
>
> In the loosing battle with the Excel users, the latest direct hit was reading
> in a file that contained strings and numeric data in each line. Having given
> up (and as the only hold out against Excel!), I need HEEELLLPPP.
>
> This is the simplified problem. I am trying to read data in the following
> format:
>
> 001a 312.194 76.922 296.301 21.462 0.453 289.515 0.957
> 001b 363.748 106.090 506.188 19.430 0.528 347.252 1.176
> 001c 398.248 138.541 724.470 17.152 0.578 383.534 1.701
> 002a 294.593 28.525 248.744 8.532 0.428 290.497 1.268
> 002b 353.415 46.290 449.015 7.974 0.513 349.565 2.011
> 002c 401.279 80.260 661.701 3.341 0.582 395.403 4.529
> ....
> ....
>
Dear Surendar,

this is my solution of this problem.

You will need additional:

http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/fileline.tar.gz
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/n_separator.tar.gz


Please have a look for further routines and licensing at
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml



FUNCTION read_excel

n_lines=fileline('excel.txt')
txt=STRARR(n_lines)
OPENR,lun,'excel.txt' ,/GET_LUN
READF,lun,txt
FREE_LUN,lun

txt=STRCOMPRESS(txt)

sep=' '
n_sep=(n_separator(txt[1],sep))[0]
pos_sep=STRPOS(txt[1],sep)

asc=STRMID(txt,0,pos_sep)
txt=STRMID(txt,pos_sep+1,10000)

data=FLTARR(n_sep,n_lines)
READS, txt, data

RETURN,{asc:asc,data:data}

END

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
=============================================
a IDL library at ForschungsZentrum J�lich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: filename
Next Topic: Re: Bug? yea or nay.

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

Current Time: Sat Oct 11 15:27:25 PDT 2025

Total time taken to generate the page: 0.71921 seconds