How do I access uigetfile elements via a loop?

5 views (last 30 days)
I have to perform the following steps on set of images via matlab GUI:
1. Read multiple images from directory
2. Process them (Apply imadjust on each image)
3. Store them in user specified or same directory while renaming them.
Can someone kindly provide me the code for the same.
I am stuck after this :
[filename, pathname,~] = uigetfile( ...
{'*.jpg;*.jpeg;',...
'JPEG Files (*.jpg,*.jpeg)';
'*.png', 'PNG files (*.png)'; ...
'*.bmp','BMP File (*.bmp)'; ...
'*.tiff;*.tif','TIFF Files (*.tiff,*.tif)'; ...
'*.*', 'All Files (*.*)'}, ...
'Pick a file',...
'Multiselect','on');
set(handles.inputpathtext,'String',pathname);

Accepted Answer

Walter Roberson
Walter Roberson on 15 Aug 2015
When you have Multiselect on, the pathname that is returned is a cell array of strings. To process each of the files you need to loop over that array.
for K = 1 : length(filename)
thisfile = fullfile(pathname, filename{K});
now process thisfile
end

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!