From: "Paul A." Date: 2011-05-09T07:14:44+09:00 Subject: Index to coordinates conversion, according the matrix shape Hello, I would like to converte an index (of a flatten array) to a multi-dimensions coordinates (of the multi-dimensions version of the previous flatten array). Example: Considering the following 2 dimensions array (3x3): [ [ -, -, - ], [ *, -, - ], [ -, -, - ] ] We can see that, the coordinates of the checked case is [0, 1]. Now, if we flat this array, it looks like: [ -, -, -, *, -, -, -, -, - ] Here, we can see the coordinate (or the index) of the checked case is 3. But how can we do the opposite? I mean, a method looking like: index_to_coordinates([3, 3], 3) # => [0, 1] Thanks! -- Posted via http://www.ruby-forum.com/.