Index exceeds matrix dimensions error?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (4개)
Maria Perdomo
2013년 6월 24일
편집: Maria Perdomo
2013년 6월 24일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!