Difficulty in knnclassify function

조회 수: 1 (최근 30일)
Karan Ratnaparkhi
Karan Ratnaparkhi 2011년 4월 24일
Hey guys i am using knnclassify funnction for 2 images my code is
clear all
a=imread('cameraman.tif');
b=imread('tire.tif');
size(a)
k=zeros(256,256);
[r c]=size(b);
for i=1:r
for j=1:c
k(i,j)=b(i,j);
end
end
group=[1;2;3];
sample=a;
training=k;
Class = knnclassify(sample,training,group);
but i am getting an error which says
??? Undefined function or method 'grp2idx' for input arguments of type 'double'.
Error in ==> knnclassify at 81
[gindex,groups] = grp2idx(group);
Error in ==> lstalgo at 20
Class = knnclassify(sample,training,group);
please help me with it.

답변 (1개)

Walter Roberson
Walter Roberson 2011년 4월 25일
knnclassify seems to be part of the bioinfo toolbox, but grp2idx seems to be part of the stats toolbox. The stats toolbox is a requirement for bioinfo toolbox; see http://www.mathworks.com/products/bioinfo/requirements.html . If you do not have the stats toolbox installed, you need to install (and license) it.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by