i got index exceeds matrix dimensions.??

1 view (last 30 days)
my vector_database table have 4 columns
%%Test Ear
clc;
clear all;
close all;
[fname, path]=uigetfile('.jpg','provide ear for testing');
fname=strcat(path,fname);
im=imread(fname);
imshow(im);
title('test ear');
%%find out which class it belongs
Ftest=FeatureStatistical(im);
%%Compare with Database
conn = database.ODBCConnection('test','root','');
curs = exec(conn,'select * from vector_database');
curs = fetch(curs);
curs.Data
Ftrain=curs(:,2:3); <-(Index exceeds matrix dimensions.)
Ctrain=curs(:,4);
for(i=1:size(Ftrain,1))
dist(1,:)=sum(abs(Ftrain(1,:)-Ftest));
end
m=find(dist==min(dist),1);
det_class=Ctrain(m);
msgbox(strcat('detected class=',num2str(det_class)));

Accepted Answer

Joseph Cheng
Joseph Cheng on 4 Nov 2018
You should put a breakpoint at that line and then check the dimensions of the curs variable. without running your code and without and example to bring in this is the best approach. I'm suspecting that you're not accessing "curs" the way you think and it is probably a struct. You're probably looking for curs.Data(:,2:3)

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!