How to select only specific files from a folder that match a list of names stored in a cell and store in a separate folder?

3 次查看(过去 30 天)
I have a list of 400 names (without the extention specified) stored in a column in a cell. I would like to select files with '.mat' extention from a folder that start with list of names provided in the cell. How may I go about doing that?

采纳的回答

Andrei Bobrov
Andrei Bobrov 2019-3-28
% Let A - list of 400 names as cell-array(400 x 1)
files = string(A) + '.mat';
n = numel(files);
C = struct;
for ii = 1:n
C.(A{ii}) = load(files{ii});
end

更多回答(1 个)

Andrei Bobrov
Andrei Bobrov 2019-3-29
mkdir('new_subfolder');
save('new_subfolder/newfile.mat','C');

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by