How do I read in images of different dimensions into an array in matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
Goodmorning somebody there, I want to read in images of different dimensions into an array but am having this error
??? Subscripted assignment dimension mismatch.
Error in ==> loadExample at 10
myArray(:,:,:,p) = imread(fullfile(H, myFile{p}));
my code is as below:
H = fullfile('C:\Users','Adigun','My Documents','One_Thousand');
myFolder = dir(fullfile(H,'0*.jpg'));
myFile = {myFolder.name};
numImage = numel(myFile);
I = imread(fullfile(H, myFile{1}));
%figure(7), imshow(I);
myArray = zeros([size(I) numImage], class(I));
%myarray(:,:,1) = I;
for p = 1:numImage
myArray(:,:,:,p) = imread(fullfile(H, myFile{p}));
end
figure(8), imshow(myArray(:,:,:,2));
댓글 수: 0
답변 (1개)
Andrei Bobrov
2012년 8월 6일
try this is code:
myArray = cell(1,numImage);
for p = 1:numImage
myArray{p} = imread(fullfile(H, myFile{p}));
end
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!