Question about DelimitedFiles

I’m having problems using the readdlm function of the DelimitedFiles package. I am reading two instances from a file. Both have this interface:

20_190\c_v20_a190_d4.txt

20 190 4
0	1	71
0	2	65
0	3	66
0	4	78
0	5	59
...

20_190\c_v20_a190_d6.txt

20 190 6
0	1	23
0	2	58
0	3	89
0	4	21
0	5	62
...

When I use the command for the instance c_v20_a190_d6.txt it goes well:

using DelimitedFiles
n = readdlm("20_190\\c_v20_a190_d6.txt", Int)[1,1]
julia> 20

But when i try to read c_v20_a190_d4.txt

using DelimitedFiles
n = readdlm("20_190\\c_v20_a190_d4.txt", Int)[1,1]

It gives an error like:

ERROR: LoadError: at row 2, column 1 : ErrorException("missing value at row 1 column 4")

what am I doing wrong?

best regards!

My guess would be that what appears to be whitespace in the header is another character.

Is it intentional that the header is (apparently) space separated while the body is tab separated?

I would try to hand-edit the first row of the d4 file to replace whatever separates the entries with tabs and see what happens.

1 Like