Difficulty in knnclassify function

1 Ansicht (letzte 30 Tage)
Karan Ratnaparkhi
Karan Ratnaparkhi am 24 Apr. 2011
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.

Antworten (1)

Walter Roberson
Walter Roberson am 25 Apr. 2011
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.

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by