MATLAB: Reading an Image after using load command

image processingImage Processing Toolbox

i have a code of 10 images,
pathname ='D:\Imagebrain\' ;
dirlist = dir( [pathname '*.jpg'] );
pickind='jpg';
X=zeros(256,256,10)
for x = 1:length(dirlist)
i = imread([pathname, dirlist(x).name]);
A=i;
X(:,:,x)=A;
save X
end
load X
now after load command please tell hoe to read images one by one

Best Answer

The same way you saved them:
for k = 1:10
A = X(:,:,k);
% do something with A
end
(Also, move the save command out of the loop -- it's just wasting time to save the data on every iteration.)