[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Processing ascii data (Heeeeelp!!)

R.Aspey (raspey@liv.ac.uk) writes:
> Firstly, thanks to those persons kind enough to repond to my previous post
> the comments were very useful.
> Basically I am reading a comma separated ascii file. It has 11 columns and
> 1800 rows. (for this example)
> I have tried the function read ascii. An example of the code I tried to
> get working is as follows:
> data=fltarr[11, 1900]    ;; order of column/rows may be wrong here!
> The matrix row/column order may be wrong (cant at the moment remember)
> I then go on to read the data in
> data=read_ascii('c:\robin.csv', DATA_START=2, delimiter=',');
> Well anyway, when I try to display the contents of the array
> which appeared to have been read in using
> print, data
> It appears that  routine has only read in the first column. I may be wrong
> but how come MATLAB does this with rediculous ease and IDL is
> some sort of programmers nightmare. Why dont these people get together
> and make one product people could really use. It annoys me immensely.
> The documentation for IDL really does not help very much at all.
> Sad when all I want to do is plot a few graphs and I have to waste a
> weekend on this. Someone really should tell them (RSI I mean)
> Kind persons comments with suggestions for  a simple solution would be
> very much welcome!!

I've never used READ_ASCII before, so I can't help you 
there. (It has always appeared brain-dead to me.) But
an 11 by 1800 comma-separated ASCII file is pretty easy:

   data = FltArr(11, 1800)
   OpenR, lun, 'myfile.dat', /Get_Lun
   ReadF, lun, data
   Free_Lun, lun

Even Matlab can't be too much simpler than that.

If you want, say, the fourth column, extract it like

   col4 = Reform(data[3,*])
> P.S. Why doesnt EXCEL produce EPS files. I suppose life would be too easy
> then.

EPS is not a Microsoft product. :-)


David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155