How do I import multiple excel files from multiple folders , with different names and sizes?

1 回表示 (過去 30 日間)
Prajwal Venkatesh
Prajwal Venkatesh 2020 年 1 月 17 日
回答済み: Prajwal Venkatesh 2020 年 1 月 17 日
Main folder has some n number of subfolders and these folders contain the excel files that I need to import to my program and store
  1 件のコメント
Rik
Rik 2020 年 1 月 17 日
This depends on how you want to store the data, but the dir function and a loop will probably do the trick.

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

回答 (1 件)

Prajwal Venkatesh
Prajwal Venkatesh 2020 年 1 月 17 日
clc;clear;
testfiledir = 'C:\Users\bidgu\OneDrive\Desktop\manpower';
matfiles = dir(fullfile(testfiledir, '*.xlsm'));
nfiles = length(matfiles);
datafi = cell(nfiles);
for i = 1 : nfiles
fid = fopen( fullfile(testfiledir, matfiles(i).name) );
datafi{i} = readtable(fid);
fclose(fid);
end
How do I use this code to read excel files?

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by