From: Seebs Date: 2009-11-22T07:30:13+09:00 Subject: Re: Finding the closest value from a matrix On 2009-11-21, Mahadev Ittina wrote: > Hello Thanks. They are limited to those spacings and those diameters, as > they are industry standards. However there are 5 more higher spacings. > So basically you are creating a map? That's filled with the values? > Thats quiet interesting. I tried the exact same thing, it says > "undefined method 'product' for for [8, 10, 12, 16]:Array" There's a few options. The simplest is just to iterate through the whole thing, remembering: * The location of the closest larger value you've previously seen * How close that value was For each value, if it is larger, see how close it is; if it's closer than your previous best guess, it becomes your new best guess. At the end of the process, you have the best guess. -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!