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

Home » Public Forums » archive » readcol with empty fields
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
readcol with empty fields [message #49909] Wed, 30 August 2006 09:02
burkina is currently offline  burkina
Messages: 32
Registered: February 2005
Member
I often use 'readcol' to read from ascii files.
However, I now have a file like this (there are actually more fields):

0.84546 | -26.05467 | Q0000-263 | 4.0980 | -30.0 | 0.0003
| 3 | | |
1.58134 | 20.20291 | MRK335 | 0.0258 | -21.8 | 0.003
| 1 | 0.007 | 1 |
10.83229 | 0.85425 | UM269 | 0.3084 | -22.7 |
| | 0.002 | 1 |
13.39559 | 12.69339 | IZW1 | 0.0611 | -23.4 | 0.003
| 1 | 0.008 | 1 |
13.71708 | 25.42722 | PG0052+251 | 0.1550 | -24.5 | 0.001
| 1 |

That is, the structure of each line is always the same, with the
delimiter |, but some fields are empty.
Therefore, when I try to read it with readcol:

readcol, table, DELIMITER='|',F='F,F,A,F,F,F,A,F,A', ra, dec, source,
z, mabs, f6, ref6, f20, ref20

only the lines with all the fields as defined in the format are read,
the others are ignored.

Instead, I need all the lines to be read and, when the field is empty,
a value of 0 (or, better, something like NULL, something that should be
ignored) should be put in the vector if it's a number, or simply the
null string if it's a string field.

How can I do that?

Thanks,

Stefano
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Combining a surface and line plot object
Next Topic: memory

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

Current Time: Wed Oct 08 19:52:56 PDT 2025

Total time taken to generate the page: 0.00295 seconds