I have issue with mahal() function

조회 수: 6 (최근 30일)
Xi Chen
Xi Chen 2015년 8월 3일
댓글: Walter Roberson 2018년 8월 6일
When I use
ds = mahal([X Y], [X Y]);
Undefined function 'mahal' for input arguments of type 'double'
or
ds = mahal(double([X Y]), double([X Y]));
Undefined function 'mahal' for input arguments of type 'double'.
Can someone help me?
The X and Y are two list. X =
0.2000
-7.1100
-3.2900
-7.1100
-3.2100
-4.9200
-0.9000
5.6700
4.6300
5.3400
3.9200
4.8000
2.8700
5.7400
4.3600
4.0000
3.4900
4.1500
2.0400
-1.2200
3.4800
2.4500
-1.2200
-2.6100
2.4200
-6.0300
-4.8400
-2.3800
0.2500
3.2500
-5.2800
-4.2900
-1.8200
2.2800
0.4800
-0.7300
2.1000
1.1200
-0.9500
-2.4400
-5.6700
-4.9500
-2.2400
-4.2000
-4.7700
0.6800
5.8500
3.3300
4.3800
6.2100
4.8400
5.8100
2.8400
0.2100
0.9400
1.5200
0.1400
2.6800
0.8200
-1.2000
-2.0400
-1.3500
-3.1400
-3.1800
-5.1700
-5.3000
-1.1400
-4.7100
And Y =
-64.7900
-32.9500
-33.7900
-23.3200
-37.2300
-27.8100
-36.5100
-27.3200
-34.4400
-59.9400
-38.5600
-29.1900
-38.3100
-27.2900
-34.8900
-26.8600
-38.2200
-26.6400
-28.9300
-23.9900
-60.3400
-36.6800
-24.1000
-34.2300
-26.6600
-36.1900
-33.3900
-58.7000
-59.6300
-65.3800
-24.8500
-24.5600
-24.5200
-65.3800
-14.7800
-34.1500
-25.9200
-28.9100
-65.4300
-34.2700
-38.1000
-64.5800
-28.1900
-64.8000
-34.1900
-24.5800
-65.8900
-25.3400
-27.9100
-66.0900
-29.0500
-35.6600
-38.3700
-34.1800
-65.5500
-29.5100
-14.8700
-36.9100
-59.5400
-28.4500
-24.9500
-34.1700
-37.3600
-28.5200
-33.4300
-27.5500
-64.8200
-27.7100
  댓글 수: 1
Xi Chen
Xi Chen 2015년 8월 4일
not working after I follow your instruction to reset everything. Undefined function 'mahal' for input arguments of type 'double'.

댓글을 달려면 로그인하십시오.

답변 (3개)

Sebastian Castro
Sebastian Castro 2015년 8월 3일
The mahal function is in the Statistics and Machine Learning Toolbox (in older releases, just Statistics Toolbox).
Do you have this installed? You can check by typing "ver" at the Command Window and seeing if it appears.
- Sebastian
  댓글 수: 3
Sebastian Castro
Sebastian Castro 2015년 8월 3일
Hmmm... I wonder why it can't find the function then. First, try typing the following command:
>> which -all mahal
... and seeing if anything comes up. If it doesn't, it may be likely that something went wrong with where MATLAB is looking for functions. You could try resetting the default MATLAB path and toolbox cache with these commands,
>> restoredefaultpath
>> rehash toolboxcache
Let's see if that works.
- Sebastian
Xi Chen
Xi Chen 2015년 8월 4일
Not working, should I reinstall it?
>> which -all mahal /Applications/MATLAB_R2015a.app/toolbox/stats/stats/mahal.m % Has no license available /Applications/MATLAB_R2015a.app/toolbox/stats/stats/@gmdistribution/mahal.m % gmdistribution method, Has no license available >> restoredefaultpath >> rehash toolboxcache >> LACS( 'test_in.txt', 'test_out.txt' ) Undefined function 'mahal' for input arguments of type 'double'.
Error in ord>pf (line 114) ds = mahal([X Y], [X Y]);
Error in ord>findoffset (line 100) offset = pf(tmp(:, Nn+1), tmp(:, Nn+2), x, tmp(:, 1:2), out_name, ths(x-1));
Error in ord (line 49) offset = findoffset(tmp, x+1, out_name, pH);
Error in LACS (line 35) ca = ord(filename, 2, out_name);

댓글을 달려면 로그인하십시오.


Sebastian Castro
Sebastian Castro 2015년 8월 4일
See how when you typed in that "which -all" command you got this:
>> which -all mahal
/Applications/MATLAB_R2015a.app/toolbox/stats/stats/mahal.m % Has no license available
/Applications/MATLAB_R2015a.app/toolbox/stats/stats/@gmdistribution/mahal.m % gmdistribution method, Has no license available
I would contact your license administrator or call MathWorks customer support to figure this out. I know absolutely nothing about licensing, but it seems like something is either wrong or expired.
- Sebastian
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 8월 6일
Right, the software is installed but you have no current valid license for it. This includes the case where you are using a license server and it has run out of licenses for that toolbox, but you would normally have seen other relevant messages as well in the license server case.

댓글을 달려면 로그인하십시오.


SHREEKANT DESHPANDE
SHREEKANT DESHPANDE 2018년 8월 6일
Hi, I am new with matlab, however reasonably understand background statistics.
I am trying to calculate mahal distance (D2 = MAHAL(Y,X))between two set of matrices (10,4) and (3, 4) however system out is NAN.
Ex:
X is
6.27123 0.0565732 -0.0205172
7.1023 0.00702738 0.0178935
6.53152 0.0418525 -0.0182539
7.42208 0.00261353 0.0146638
3.32587 0.0585499 0.008547
7.27152 -0.0279264 0.0625709
6.39666 0.0161053 0.0292219
-8.31145 0.442099 0.0748912
-5.63082 -0.0296625 -0.211935
-8.44003 0.446935 0.0856395
and Y is
-9.89905 -0.0802276 -0.233074
-2.55819 -0.456706 -0.145712
-9.48164 -0.477232 0.336065
Please help me in calculating this distance. Thank you

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by