Hi Thanks for this. Have tried with with the following file called RubyTest.txt
1,2,3
4,5,6
7,8,9

so the code is as follows:

M:\John N\RubyTest.txt
results = []
ARGF.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


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

c:\0kjk\a1\TAGM-ver4\jobs\JN_Matrix_3.rb:3: syntax error
ARGF.each do |record|




-----Original Message-----
From: Peña, Botp [mailto:botp / delmonte-phil.com]
Sent: 09 October 2007 02:29
To: ruby-talk ML
Subject: Re: MATRIX PROBLEMS (AGAIN!)


From: John Nott [mailto:JNott / dto.ie] 
# This seems to work very well thanks but the results are 
# produced in a long string. Is it possible to create these 
# figures as a matrix? (resembling something like excel)
# Thanks for your help.

i just modified 7studs's code,

C:\family\ruby>cat test.txt
1,2,3
4,5,6
7,8,9

C:\family\ruby>cat test.rb
results = []
ARGF.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


C:\family\ruby>ruby test.rb test.txt
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]

1       2       3
4       5       6
7       8       9

C:\family\ruby>ruby test.rb
1,2,3
4,5,6,7
8,9
10
^Z
[[1, 2, 3], [4, 5, 6, 7], [8, 9], [10]]

1       2       3       nil
4       5       6       7
8       9       nil     nil
10      nil     nil     nil

C:\family\ruby>

hth -botp

#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
#####################################################################################