Victor Reyes wrote:
> ..I need to be
> able to define my matrix dynamically and on demand.
> Can anyone tell me how to do that?
> 

Try this:

#get input:
print 'rows: '
rows = Integer(gets)
print 'columns: '
cols = Integer(gets)


#create matrix:
matrix = []
rows.times do |i|
  matrix << Array.new(cols, 0)
end

p matrix


Or this:

require 'matrix'

print "size: "
size = Integer(gets)

m = Matrix.zero(size)
p m
-- 
Posted via http://www.ruby-forum.com/.