TNeykov
TNeykov

Reputation: 73

How to read specify columns from file in GNU OCTAVE?

In GNU OCTAVE, I have input file like this, and i have to read only first and second columns and store to variable. . This is only small part of my file. When so, i can not read whole file and cut a column that i need. I should read only what i need, to save a memory.

1 2 1 1015887601
1 3 1 1015887601
1 4 1 1015887601
1 5 1 1015887601
1 6 1 1015887601
1 7 1 1015887601
1 8 1 1015887601
1 9 1 1015887601
2 10 1 1015887601
2 11 1 1015887601
2 12 1 1015887601
3 13 1 1015887601
3 14 1 1015887601

Upvotes: 0

Views: 2446

Answers (1)

Pokey McPokerson
Pokey McPokerson

Reputation: 752

Check out dlmread. Octave has the same function, it seems to do what you need.

Something like:

dlmread('yourfile.txt', ' ', 'A1..Bn') % replace n with the size of the file

Upvotes: 1

Related Questions