Re: How can I read data file with tab delimeter? [message #5548] |
Fri, 12 January 1996 00:00 |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
The best routine I have found for this purpose is DDREAD.PRO,
available as part of Fred Knight's library at
ftp://ftp.rsinc.com/pub/user_contrib/knight
From the online documentation:
; This routine reads data in formatted (or unformatted) rows and columns.
; The name stands for Data Dump Read. By default, comments are
; skipped and the number of columns is sensed. Many options
; exist, e.g., selecting rows and columns, reading binary data,
; and selecting non-default data type and delimiters.
It also reads TAB delimited files. The best thing is that you don't
have to know the number of rows and columns in advance - DDREAD figures it out.
Do yourself a favor and get it.
Cheers,
Liam.
|
|
|
Re: How can I read data file with tab delimeter? [message #5553 is a reply to message #5548] |
Thu, 11 January 1996 00:00  |
M.W.Gardner
Messages: 7 Registered: November 1995
|
Junior Member |
|
|
ashi@acacia.lle.rochester.edu (Alexei Chirokikh) wrote:
> Hi,
> I have column organized data with TAB - delimeter. How can I read this data?
>
Assuming your data is organised in a consistent manner (i.e. all rows and
columns contain the same number of data points) then thus is really easy..
Assume your file is organised with 5 columns and 4 rows and contains floating
point data.
The IDL code to read this into the array my_data is as follows
my_data=fltarr(5,4) ;define array of correct dimensions and type
openr,lun,'my_tab_file.dat',/get_lun ;open file
readf,lun,my_data ;read data into array maintaining structure in file
close,lun ;close file
free_lun,lun ;free logical file unit
IDL can reads tabs as multiple space delimiters - you do not have to specify
the fact that the delimiter is a tab.
Hope that helps - if not get in touch.
Matt
--
-----> Matt Gardner EMAIL->m.W.gardner@uea.ac.uk PHONE->+44- 1603-592041
School of Environmental Science,University of East Anglia,Norwich,NR4 7TJ,UK
------------------------------------------------------------ ------------------
opinions are mine - http://www.uea.ac.uk/~e449
|
|
|