rgilaard
5/10/2005 11:08:00 AM
Dear all,
I am new to Ruby and I'm looking for a way to use Ruby (1.8) to read a part of
a textfile into a matrix.
The textfile lokks like:
=== Confusion Matrix ===
a b c <-- classified as
7494 4044 100 | a = WEL
2039 18691 11 | b = NIET
707 293 441 | c = NOOIT
So what i want is that this matrix is read into a matrix variable in a ruby
program which I can use then to manipulate in every way I want.
Can someone help me with this?
I figured out that I could maybe use a regexp /\s*a\s*/ to search for the line
with a b c
Then I skip that line and start to read the following line position by position
into the first row of the 3-by-3 matrix.
How could this be done?
Thanks in advance,
Robert Gilaard