Index exceeds matrix dimensions error?
1 view (last 30 days)
Show older comments
What is the problem? Here is my code:
dirs = {'pos1','pos2','pos3'};
groups = {'unflashed','flashed_1xsett3','flashed_1xsett3_15sec','flashed_1xsett5','flashed_1xsett5_15sec','flashed_2xsett5','flashed_2xsett5_15sec'};
groups_bin = {'0', '1', '2','3','4','5','6','7'};
fprintf('%s\n',['Reading ' base_path]);
for d = 1 : length(dirs)
fprintf('%s',['\' dirs{d}]);
for g = 1 : length(groups);
fprintf('%s',['\' groups{g}]);
for f = 1 : 1
for led = 1 : 9
fname = ['imageL' num2str(led) '_' num2str(f-1) '.png'];
fprintf('%s',['\' fname]);
try
img{d, g, f, led} = imread(fullfile(base_path,person,dirs{d},groups{g},fname));
catch
img{d,g,f,led}=[];
end
fprintf(repmat('\b',1,length(fname)+1));
end
end
fprintf(repmat('\b',1,length(groups{g})+1));
end
fprintf(repmat('\b',1,length(dirs{g})+1));
end
fprintf('\n');
0 Comments
Answers (4)
Maria Perdomo
on 24 Jun 2013
Edited: Maria Perdomo
on 24 Jun 2013
the line problem is 3 lines before the end:
fprintf(repmat('\b',1,length(dirs{g})+1));
dirs has just 3 elements, but g reaches up to 7:
for g = 1 : length(groups);
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!