How do I access uigetfile elements via a loop?

5 vues (au cours des 30 derniers jours)
slickbot
slickbot le 15 Août 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);

Réponse acceptée

Walter Roberson
Walter Roberson le 15 Août 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

Plus de réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by