フィルターのクリア

xlsread from different folders

9 ビュー (過去 30 日間)
ricco
ricco 2011 年 12 月 1 日
I have 4 folders in the same directory where each folder contains ~19 .xls files. I have written the code below to obtain the name of each of the folders and the name of each .xls file within the folders.
path='E:\Practice';
folder = path;
dirListing = dir(folder);
dirListing=dirListing(3:end);%first 2 are just pointers
for i=1:length(dirListing);
f{i} = fullfile(path, dirListing(i,1).name);%obtain the name of each folder
files{i}=dir(fullfile(f{i},'*.xls'));%find the .xls files
for j=1:length(files{1,i});
File_Name{1,i}{j,1}=files{1,i}(j,1).name;%find the name of each .xls file
end
end
Now I'm trying to import the data from excel into matlab by using xlsread. What I'm struggling with is knowing how to load the data into matlab within a loop where the excel files are in different directories (different folders).
This leaves me with a 1x4 cell named File_Name where each cell refers to a different folder located under 'path', and within each cell is then the name of the spreadsheets wanting to be imported. The size of the cells vary as the number of spreadsheets in each folder varies.
Any ideas?
thanks in advance

回答 (1 件)

Robert Cumming
Robert Cumming 2011 年 12 月 1 日
this is the same problem as your previous question
Stick to one question for the problem.
  2 件のコメント
ricco
ricco 2011 年 12 月 1 日
Wow i'm sorry if I confused you with 2 questions, I admit 2 is a lot.
Robert Cumming
Robert Cumming 2011 年 12 月 1 日
i'm not confused - the question appears to be the same as your other one.

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

カテゴリ

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