Difficulty in knnclassify function
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Walter Roberson
on 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.
0 Comments
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!