readcol with empty fields [message #49909] |
Wed, 30 August 2006 09:02 |
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
|
|
|