MATLAB: Error using pdist to calculate euclidean distance .

pdist

When I am using pdist for ,X=rand(3,2); D=pdist(X);it gives 'Error using pdist (line 21) Struct contents reference from a non-struct array object. ' What is the error ?

Best Answer

So what should be the way forward ?
Don't use the same name as matlab functions for your own function. The way forward is to rename that offending pdist to something else.