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};

Answers (2)

Thorsten
Thorsten on 19 Oct 2015
Edited: Thorsten on 19 Oct 2015
splittedLine{2} seems to have fewer than 2 cells.

2 Comments

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.

Sign in to comment.

Asked:

on 19 Oct 2015

Commented:

on 19 Oct 2015

Community Treasure Hunt

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

Start Hunting!