| Re: Reading and Plotting big txt. File [message #55168 is a reply to message #55117] |
Thu, 02 August 2007 09:55   |
Conor
Messages: 138 Registered: February 2007
|
Senior Member |
|
|
The problem is your format statement. What's going on is that with a
format, IDL doesn't actually read columns. It is more of directions
where to find the data. In your case, you aren't telling it where the
spaces are, so it assumes that everything is a data column. If you
specify 10(a4), it is really reading:
aaaabbbbccccddddeeeffffgggghhhhiiiijjjj
where aaaa = column1, bbbb = column2, etc...
You need to give it the appropriate number of spaces, otherwise the
data get's all messed up. For example, apply the above "filter" to
the data below (from your file)
7 -1848 -1792 -1718 -1678 -1638 -1576 -1517
-1446 -1372 -1322
The first four columns ' 7 ' are assigned to the first column in your
data array. The second four columns ' ' go to the second column in
your data array, etc.. In the end you get:
data = [ 7 ',' ',' -1','848 ',' -17','92 ',' -17','18 ',' -16']
(or something along those lines, anyway)
What you need to do is actually specify where the spaces are:
format = '(a2, 7x, a4, 2x, a4, 7( 3x, a4 ) )'
I don't think that's quite it, but it probably needs to be something
along those lines. I can't quite get it to work myself,
unfortunately. I wish someone better informed about formats would
join in the conversation here...
|
|
|
|