Error with inpaint_nans

2 views (last 30 days)
kco
kco on 7 Jul 2016
Commented: kco on 7 Jul 2016
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!

Accepted Answer

John D'Errico
John D'Errico on 7 Jul 2016
Edited: John D'Errico on 7 Jul 2016
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.
  2 Comments
kco
kco on 7 Jul 2016
I think I did have a file called unique and I did right click, delete ,and them empty my trash. Is there a way it's still there? I did this a couple weeks ago when I realized I kept getting that error when I ran my other files.
This is what I get when I do which unique -all Keep in mind I'm no expert, I just took matlab at school at one point and am trying to use it for a set of data I want to look at Thanks for helping me!
/Users/kco/matlab/unique.m /Applications/MATLAB_R2013b.app/toolbox/matlab/ops/@cell/unique.m % cell method /Applications/MATLAB_R2013b.app/toolbox/matlab/datatypes/@table/unique.m % table method /Applications/MATLAB_R2013b.app/toolbox/matlab/datatypes/@categorical/unique.m % categorical method /Applications/MATLAB_R2013b.app/toolbox/rtw/rtw/@RTW/unique.p % RTW method /Applications/MATLAB_R2013b.app/toolbox/shared/statslib/@dataset/unique.m % dataset method /Applications/MATLAB_R2013b.app/toolbox/symbolic/symbolic/@sym/unique.m % sym method /Applications/MATLAB_R2013b.app/toolbox/matlab/ops/unique.m % Shadowed >>
kco
kco on 7 Jul 2016
I think I fixed it. I had a download somewhere in my computer called unique.m. It was from my class. Thanks for the help and for the function! Best.

Sign in to comment.

More Answers (0)

Categories

Find more on Oceanography and Hydrology in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!