i got index exceeds matrix dimensions.??

1 Ansicht (letzte 30 Tage)
mayur sonawale
mayur sonawale am 4 Nov. 2018
Kommentiert: mayur sonawale am 4 Nov. 2018
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)));

Akzeptierte Antwort

Joseph Cheng
Joseph Cheng am 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)

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by