How do I access uigetfile elements via a loop?
4 views (last 30 days)
Show older comments
slickbot
on 15 Aug 2015
Answered: Walter Roberson
on 15 Aug 2015
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);
0 Comments
Accepted Answer
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
0 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!