From: Joel Pearson Date: 2013-02-15T23:55:35+09:00 Subject: Re: Select "columns" from multidimensional array? Hah, I wrote that head exploding comment first and then managed to work out what it did afterwards. Still took a few minutes of smashing my head into the desk to make room for the new thought though ;¬) Using a Hash sounds like a good idea. I already tried rewriting the selector into something a bit more excel-like (although I won't bore you with all the little changes): def []( addr ) col, row = addr.upcase.scan( /([A-Z]+)(\d+)/ ).flatten data[ index( row, col ) ] end def []=( addr, val ) col, row = addr.upcase.scan( /([A-Z]+)(\d+)/ ).flatten data[ index( row, col ) ] = val end m = Matrix.new(%w{A B C}, %w{1 2 3 4}) m["A1"] = 123 m["B4"] = 123 I haven't gotten around to changing all the "row, col" to "col, row" references, so it looks a bit weird, but I'm just experimenting with options at the moment. I'll have a go at Hashing it up as well. Naturally I have many questions floating around in my head, but I'll try to work them out through the scientific method of repeated failed attempts :) -- Posted via http://www.ruby-forum.com/.