MATLAB: Why i m getting this error “Array indices must be positive integers or logical values. or min=min(dist);” please help me out

geoff hayes

%% 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<3)
m=find(dist==min,1);
det_class=cstrain(m);
msgbox(strcat('dectected class',num2str(det_class)));
else
msgbox('This person is not register');
end

Best Answer

You cannot call the min function while a variable named min exists in the workspace. Rename or remove the variable.