function D = pdist2( X, Y, metric ) ↑ Error: Function definition not supported in this context. Create functions in code file.
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
function D = pdist2( mX,mY, metric )
if( nargin<3 || isempty(metric) ); metric=0; end;
switch metric
  case {0,'sqeuclidean'}
    D = distEucSq( X, Y );
  case 'euclidean'
    D = sqrt(distEucSq( mX, mY ));
  case 'L1'    
    D = distL1( mX, mY );
  case 'cosine'
    D = distCosine( mX, mY );
  case 'emd'
    D = distEmd( mX, mY );
  case 'chisq'
    D = distChiSq( mX, mY );
  otherwise
    error(['pdist2 - unknown metric: ' metric]);
end
댓글 수: 0
채택된 답변
  Walter Roberson
      
      
 2020년 4월 2일
        You cannot copy and paste that into the command line. You would need to store it in a file named pdist2.m 
You will also need to define distEucSq and other related functions.
That code appears to be part of Piotr's "Classify Toolbox". You should install that https://github.com/pdollar/toolbox or you can probably get it from the Add-Ins Manager; https://www.mathworks.com/matlabcentral/fileexchange/56689-pdollar-toolbox 
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

