1

I am facing a strange situation in MATLAB. MATLAB function pdist is not working. It is showing an error Undefined function 'pdist' for input arguments of type 'double'.

This function is defined in Statistics Toolbox. I thought followings: (i) May be my inputs to this function are not correct or (ii) I do not have access to this function (i.e. may be I do not have Statistics Toolbox in MATLAB.

To check the first point, I went to the help window of MATLAB and then, searched for this function there. At the end of the page, there are some examples given. I copied one simplest and tried it in the MATLAB command window. Unfortunately, it is showing the same error mentioned above. Strange, because at least I expect this example to run normally.

To check the second point, I went to the start button in MATLAB. There I can see I have a Statistics Toolbox. I tried another way that is, typing ver('stats') in the command window. It also shows me about the details of the Statistics Toolbox. And, the last way, I went to my C: derive where I have installed MATLAB. There also in the toolboxes, I can see a file which has a function pdist.

Does anybody has any idea, whats wrong going on here? or what could be next possibility that I can check for its validity? Thanks.

Sanchit
  • 3,180
  • 8
  • 37
  • 53
  • 2
    Type "which pdist". If it doesn't find anything, check your MATLAB paths. – nkjt Nov 08 '13 at 08:53
  • Please check whether statistics toolbox is added in Matlab path – User1551892 Nov 08 '13 at 08:59
  • 1
    `which -all pdist` will list all the `pdist` MATLAB files in your MATLAB path – am304 Nov 08 '13 at 09:26
  • 2
    @all, thanks a lot. It shows a path (C:\Program Files\MATLAB...), however at the end, it shows an important message. Which is "Has no license available". Now, it is confirmed that I do not have a license. – Sanchit Nov 08 '13 at 09:38
  • But the real question is: do you really need pdist? –  Nov 08 '13 at 12:38
  • 1
    @Sanchit: See my [answer to this SO question](http://stackoverflow.com/a/17799550/2278029) for a version of `pdist` written in pure Matlab as well a mex C version that is faster than the underlying `pdistmex` function that `pdist` uses. – horchler Nov 08 '13 at 14:20
  • @Sanchit - [Here are two short `pdist`-equivalent MATLAB solutions](http://stackoverflow.com/a/19456458/2778484) with computation time comparisons. – chappjc Nov 08 '13 at 22:29
  • @all I got the license for the statistics toolbox. Thanks for the concern. – Sanchit Nov 12 '13 at 09:39

1 Answers1

1

I guess you have already answered your own question.

You need to have the licence for the statistics toolbox to run pdist.

If you believe that you should have this licence, contact mathworks support.

If you realize that you won't have the licence you can try to find/make an implementation without the statistics toolbox. Depending on what you want to achieve this may not be very hard.

Of course, if you get stuck working around it you can post a new question on Stack Overflow.

Dennis Jaheruddin
  • 21,208
  • 8
  • 66
  • 122