i got index exceeds matrix dimensions.??

1 次查看(过去 30 天)
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)));

采纳的回答

Joseph Cheng
Joseph Cheng 2018-11-4
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by