Info

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

Index exeeds matix dimensions in loading image folder.

조회 수: 2 (최근 30일)
Taiwo
Taiwo 2012년 7월 30일
마감: MATLAB Answer Bot 2021년 8월 20일
am a new person with MATLAB, but I want to load some images saved in a folder into an array and display/process. the error am having is "index exceeds matrix dimension" the code is given below:
H = 'C:\Users\Adigun\Documents\Naira.jpg';
myFolder = dir(fullfile(H,'Image1*.jpg'));
myFile = {myFolder.name};
numImage = numel(myFile);
I = imread(myfile{1});
myArray = zeros([size(I) numImage], class(I));
myArray(:,:,1) = I;
for p = 2:numImage
myArray(:,:,p) = imread(myfile{p});
end
the error is on this line: I = imread(myfile{1});
Pls somebody help

답변 (1개)

Albert Yam
Albert Yam 2012년 7월 30일
If that is a direct copy of your code. Matlab is case sensitive, myFile and myfile.
myFile = {myFolder.name};
...
myArray(:,:,p) = imread(myfile{p}); %typo - Matlab is case sensitive

Community Treasure Hunt

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

Start Hunting!

Translated by