フィルターのクリア

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