OK fair point!
Tried it like this:
File.open("M:\\John N\\RubyTest\\Test.txt") do |file|
results = []
File.each do |record|
results << record.split(",").map{|x| x.to_i}
end
p results
puts
s=results.size
s.times do |y|
s.times do |x|
print results[y][x],"\t"
end
puts
end
Giving me a syntax error in line 18 though (as in the last 'end')
which is the same even when i remove it!
-----Original Message-----
From: list-bounce / example.com [mailto:list-bounce / example.com]On Behalf
Of 7stud --
Sent: 09 October 2007 10:52
To: ruby-talk ML
Subject: Re: MATRIX PROBLEMS (AGAIN!)
John Nott wrote:
>
> However I get the follwoing error message
>
> Error: c:\0kjk\a1\TAGM-ver4\jobs\JN_Matrix_3.rb:1:syntax error
>
> M:\John N\RubyTest.txt
>
Is it your understanding that this line is ruby code:
M:\John N\RubyTest.txt
What do you think it does?
You are supposed to be learning to write programs here--not just copying
and pasting text.
--
Posted via http://www.ruby-forum.com/.
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by MailMarshal
#####################################################################################