Index exceeds matrix dimensions.
Show older comments
Error in ImageClassifier (line 11)
Ftrain=db(:,1,2);
Test Image
[fname,path]=uigetfile('.jpg','Provide a Image for Testing');
c=strcat(path,fname);
im=imread(fname);
imshow(im);
title('Test Image');
%% Fond out which Class it Belongs to
Ftest=FeatureStatistical(im);
%% Compare with Database
load db.mat
Ftrain=db(:,1,2);
ctrain=db(:,3);
for(i=1:size(Ftrain,1))
dist(1,:)=sum(abs(Ftrain(1,:)-Ftest));
end
Min=min(dist);
if(Min<50)
m=find(dist==Min,1);
det_class=ctrain(m);
msgbox(strcat('detected class',num2str(det_class)));
else
msgbox('Not Exist');
end
Accepted Answer
More Answers (1)
madhan ravi
on 11 Dec 2018
Ftrain=db(:,[1,2]);
^---^----square brackets
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!