Please help me to fix Index exceeds matrix dimensions error.

My code is...
imgListFile = fopen('D:\image_class.txt', 'r');
F = zeros(6, 24); L = cell(6, 1);
tline = fopen(imgListFile); currentLine = 1;
while ischar(tline)
for i = 1 : length(srcFiles)
disp(tline)
splittedLine = regexp(tline, ',[ ]*', 'split');
srcFiles = dir('D:\My old data\Heatmap\my\imgs\*.jpg'); % the folder in which ur images exists
filename = strcat('D:\My old data\Heatmap\my\imgs\',srcFiles(i).name);
I = imread(filename);
% Extract the SFTA feature vector from the image.
imagePath = fullfile('imgs',splittedLine{1});
f = sfta(I, 4);
F(currentLine, :) = f;
% Store the image label.
L{currentLine} = splittedLine{2};
tline = fgetl(imgListFile);
currentLine = currentLine + 1;
end
end;
fclose(imgListFile);
My error is...
Error in Nb (line 21) L{currentLine} = splittedLine{2};

Antworten (2)

Thorsten
Thorsten am 19 Okt. 2015
Bearbeitet: Thorsten am 19 Okt. 2015

0 Stimmen

splittedLine{2} seems to have fewer than 2 cells.

2 Kommentare

Thanks Thorsten Sir, how to increase cells for splittedLine?
splittedLine is defined using
splittedLine = regexp(tline, ',[ ]*', 'split');
that is based on the file contents. So you have to modify your program to deal with lines that cannot be splited in two parts.

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 19 Okt. 2015

Kommentiert:

am 19 Okt. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by