Difficulty in knnclassify function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (1)
Walter Roberson
el 25 de Abr. de 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.
0 comentarios
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!