how to run multiple xlsx files once

1 回表示 (過去 30 日間)
Mike
Mike 2019 年 10 月 31 日
コメント済み: galaxy 2019 年 11 月 1 日
Hello,
I have a code which use one xlsx file from source folder, analyzes it and creates file into destination folder.
I would like to use this code as it is, but use multiple xlsx files at once at the source folder, and creates all new files at once into the destination folder.
thanks
  1 件のコメント
Alex Mcaulley
Alex Mcaulley 2019 年 10 月 31 日
Without more details, you will need a loop to call the function for each file

サインインしてコメントする。

回答 (1 件)

galaxy
galaxy 2019 年 10 月 31 日
You can use following steps:
% select path
work_path = uigetdir('pwd', 'Select folder');
% find all xlsx files in folder
% findfiles function can get in: https://www.mathworks.com/matlabcentral/fileexchange/172-findfiles
work_files = findfiles('*.xlsx', work_path);
num_file = length(work_files);
for cnt_file=1:num_file
%% analysis as your code
% when want to get name of current excel file, use work_files(cnt_file), convert from cell to string if need
end
  2 件のコメント
Mike
Mike 2019 年 10 月 31 日
編集済み: Mike 2019 年 10 月 31 日
Hey,
thank you,
but I have a problem with "findfiles", it is an 'Undefined function or variable'.
do you know maybe why?
thanks
galaxy
galaxy 2019 年 11 月 1 日
You can copy findfiles function to your source code.
--> It will be OK

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by