BUG (??) :pdist x dist x pdist2
    4 views (last 30 days)
  
       Show older comments
    
Hi all,
I always used pdist to calculate euclidian distance between two points, but suddenly my m.file began to complain that "?? Error using ==> pdist Too many input arguments.". Well, how is possible for one routine that was working fine begin to complain after I tried "dist" in another routine ?
Anyway, I figure it out that maybe pdist is not the best choice for only two points distance. Is "dist" the correct function?
Thanks in advance.
Paulo.
0 Comments
Accepted Answer
  Wayne King
    
      
 on 15 Oct 2012
        Without addressing your issue with pdist, you can use norm()
   x = [1 -1];
   y = [1  1];
   norm(x-y,2)
   % norm(x-y,1)
Note that norm(x-y,2) is the same as
   pdist([x' y'])
5 Comments
  Star Strider
      
      
 on 16 Oct 2012
				I'm glad I could help!
Since your code worked on your laptop and not your desktop, I guessed you had to be shadowing pdist on your desktop.
More Answers (0)
See Also
Categories
				Find more on Statistics and Machine Learning Toolbox 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!


