Dear all,
Happy new year 2017 to all of you.
I have run following code
% Specify the folder where the files live.
myFolder = 'C:\Program Files\MATLAB\R2013a\bin\mri';
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isdir(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
uiwait(warndlg(errorMessage));
return;
end
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.png'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
imageArray = imread(fullFileName);
imshow(imageArray); % Display image.
drawnow; % Force display to update immediately.
end
now output is as follows....
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0001.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0002.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0003.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0004.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0005.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0006.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0007.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0008.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0009.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0010.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0011.png
Now reading C:\Program Files\MATLAB\R2013a\bin\mri\0012.png
etc
Now how to stack all those images.
I am a beginner. So please give me some example.
Thanking you in advance.