Prev: Remember the Consolidator by John D'Errico?
Next: Why does this line of code take so long to execute?
From: John D'Errico on 16 Jun 2010 19:26 "Lisandro " <lisandro.quinones(a)gmail.com> wrote in message <hvbh89$1g3$1(a)fred.mathworks.com>... > Hi all, > > I have 2 columns of 1000 points of data each that I wish to use as my x and y inputs for interp1, sadly my data is repetitive by definition and interp1 needs distinctive x data. > > I was looking in the Mathworks Community and came across the Consolidator by John D'Errico which seems to do the job. However, when I use it, it deletes/removes all of the repetitive data points just like the 'unique' function would do; it also orders the data in ascending order. > > Someone out there well versed with the Consolidator or with an alternate solution to my problem? I would like my data to retain its original order and the repetitive points NOT to be removed but just modified by a 0.0001 sum; i.e.: > > 600 to 600.0001 > 600 to 600.0002 > 600 to 600.0003 > > Thank you! Some years ago, I had a similar problem. In my case, it reflected a problem with shapers in image processing. One solution is to use a tool like the unrounding utility I posted on the file exchange. http://www.mathworks.com/matlabcentral/fileexchange/8719 X = floor((0:25)'.^2/25); [X,unround(X)] ans = 0 0 0 0.25 0 0.5 0 0.75 0 1 1 1.25 1 1.5 1 1.75 2 2 3 3 4 3.6667 4 4.3333 5 5 6 6 7 7 9 9 10 10 11 11 12 12 14 14 16 16 17 17 19 19 21 21 23 23 25 25 I don't know if this solves your problem or not, but it is a pretty application of linear algebra. There are certainly less high-tech solutions to be found. John |