??? Index exceeds matrix dimensions
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hi, can anyone help me with this error ??? Index exceeds matrix dimensions..here is my code
close all;
clear all;
lambda2 = [2 4 6 8];
theta2 = [0*pi/180, 45*pi/180, 90*pi/180, 135*pi/180, 180*pi/180, 225*pi/180, 270*pi/180, 315*pi/180];
no_lamd = 4;
no_theta = 8;
psi = [0 pi/2];
gamma = 0.5;
bw = 1;
N = 1;
%%%%%%%%%%%%%%%%%%%%%%%%
ext = '.bmp';
dirr = 'D:\GPDSdataset\';
%[tr_data, tr_class, x, y, answer] = textread('train_file.txt','%s %d %f %d %s'); %train
[tr_data] = textread('trainfile_source.txt','%s'); %train
[mtr ntr] = size(tr_data);%mtr
%assign class no
model = 100;
train = 5;
cnt = 0;
for i=1:5:5*model
cnt = cnt + 1;
for j = 0:1:4
ts_class(i+j)=cnt;
end
end
save ts_class ts_class
%select train image
model = 100;
cnt1 = 0;
cnt2 = 0;
for j = 1:20:20*model
for i = 0:1:4
cnt1 = cnt1+1;
AR_train(cnt1)= tr_data(j+i);
end
cnt2 = cnt2+1;
AR_test(cnt2) = tr_data(j+5);
end
size(AR_train');
size(AR_test');
??? Index exceeds matrix dimensions.
3 comentarios
Sean de Wolski
el 26 de Ag. de 2011
The error message probably says what line the indexing error is on as well, please report that.
Respuestas (1)
Jan
el 26 de Ag. de 2011
Using the debugger would lead you to a solution efficiently:
dbstop if error
Then start the program. Now MATLAB stops, when the error occurs and you can inspect the current values of the variables in the command window or workspace browser. Finally you can find out by yourself, which index exceeds which dimension of which variable.
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!