MATLAB: Error with inpaint_nans

inpaint_nans

Hi! i'm getting this error when I try to call inpaint_nans function on my nxm matrix
inpaint_nans(ingdata)
" Error using unique (line 29) First parameter must be a square matrix
Error in inpaint_nans>identify_neighbors (line 550) neighbors_list=unique(neighbors_list,'rows');
Error in inpaint_nans (line 155) neighbors_list=identify_neighbors(n,m,nan_list,talks_to); "
any idea as to why? I should add that often times when I run things i get the error "Error using unique (line 29)" even when I don't use the 'unique' function in my script or function file.
Thanks!

Best Answer

Other tools often use the function unique. In this case, inpaint_nans does exactly that. So why are you surprised? The functions that MATLAB provides are used all over the place.
As far as getting an error, I (the fellow who wrote inpaint_nans) have no idea what you have done, since you do not show us the matrix you are passing to it. Perhaps you are trying to use it on some strange array type. (I cannot recreate your error. inpaint_nans has error checks to look for at least a few of the common mistakes I would expect.)
If I had to make a guess, I think you have a function named unique on your search path, since unique does not return that as an error in any way that I can create. So do this:
which unique -all
then see if you have an m-file named unique. If you do, then change the name. DON'T NAME YOUR FILES WITH THE NAMES OF USEFUL TOOLS IN MATLAB! If you do, then expect to get random errors.
Finally, if the above command does not identify a spurious unique function that you have created, then you need to tell more information. What release of MATLAB are you using? Is this a REALLY old release? inpaint_nans was written a LONG time ago, so that should not be a factor.