How do I access uigetfile elements via a loop?

5 ビュー (過去 30 日間)
slickbot
slickbot 2015 年 8 月 15 日
回答済み: Walter Roberson 2015 年 8 月 15 日
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);

採用された回答

Walter Roberson
Walter Roberson 2015 年 8 月 15 日
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 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by