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.
Difficulty in knnclassify function
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File 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!