I want to imread multiple selected files via uigetfile

2 ビュー (過去 30 日間)
KiBaek Jang
KiBaek Jang 2022 年 5 月 24 日
編集済み: DGM 2022 年 5 月 24 日
file=uigetfile('*.*', 'select a single file at a time', 'download', 'MultiSelect','on');
image=string(file);
imagea = imread(file(1)); % It is impossible to convert from cell format to string format to use imread.
imageb = imread(file(2));

回答 (1 件)

DGM
DGM 2022 年 5 月 24 日
編集済み: DGM 2022 年 5 月 24 日
This assumes that the images are all simple I/RGB images (not indexed images, no RGBA images or multiframe GIFs)
[fname dirname] = uigetfile('*.*', 'select a single file at a time', 'download', 'MultiSelect','on');
nfiles = numel(fname);
pileofimages = cell(nfiles,1);
for f = 1:nfiles
pileofimages{f} = imread(fullfile(dirname,fname{f}));
end
The images are stored in the cell array 'pileofimages' to avoid creating a drift of dynamically named variables and all the problems that entails.

カテゴリ

Help Center および File ExchangeImport, Export, and Conversion についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by