필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

I am getting an error as index exceeds matrix dimensions? How do i solve this?

조회 수: 1 (최근 30일)
Surya
Surya 2013년 3월 30일
inputPath= 'D:\MATLAB.R2010a.X86.Portable\MATLAB.R2010a.X86.Portable\App\toolbox\images\imdemos';
dir(inputPath);
tifFiles = dir([inputPath '\*.tif']);
for k = 1:length(tifFiles)
filename = tifFiles(k).name;
rgbImage = imread(filename);
% operations on "I"
[rows columns numberOfColorBands] = size(rgbImage);
subplot(2, 2, 1);
imshow(rgbImage, []);
pause;
% Extract the individual color planes.
redPlane = rgbImage(:, :, 1);
greenPlane = rgbImage(:, :, 2);
bluePlane = rgbImage(:, :, 3);
figure, imshow(redPlane);
figure,imshow(greenPlane);
figure,imshow(bluePlane);
b = redPlane + greenPlane + bluePlane;
figure,imshow(b);
pause;
end

답변 (1개)

Matt J
Matt J 2013년 3월 30일
I am getting an error as index exceeds matrix dimensions? How do i solve this?
Using DBSTOP
  댓글 수: 2
Ruhi
Ruhi 2013년 3월 30일
that will tell u the line on which the error occurred, which i know is on line 20. how do i resolve it?
Matt J
Matt J 2013년 3월 30일
Line 20 in the code you've shown is
figure,imshow(greenPlane);
Can't see any problem there. "index exceeds matrix dimensions" means you've used an index larger than an array dimension, e.g.,
>> x=rand(1,5); x(6)
Index exceeds matrix dimensions.
DBSTOP will stop the code execution at the point where the error occurs. You can then check the size of the array being indexed and the value of the index and see what is wrong.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by