Importing and appending a complete folder of excel files
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I have a folder in which I have around 225 excel files: MA1.xlsx,MA2.xlsx,....MA225.xlsx. all of them have the same column numbers. Is their a way to import all these to Matlab in one shot and append them to a table?
In other words can if all these excel files are under the folder C:\Users\w\Documents\Matla\Data , can I import the entire folder to matlab and append the files that are in it to create a large table?
Your help is greatly appreciated, otherwise I need to create the names and a loop I believe?
0 commentaires
Réponse acceptée
Jan
le 28 Jan 2019
It depends on what "in one shot" means. It is trivial to create a loop to import one file after the other, see FAQ: Access a sequence of files .
Base = 'C:\Users\w\Documents\Matla\Data';
List = dir(fullfile(Base, '*.xlsx'));
Result = cell(1, numel(List));
for k = 1:numel(List)
File = fullfile(Base, List(k).name);
Result = readtable(File); % Or specify what you want to import
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!