How to import excel file from multiple subfolders?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm trying to import excel files which are located within subfolders. Each folder contains a excel file with the same file name (GMM1.xlsx)
Top folder -> subfolder -> List of files
2003 data ->20030622 ->GMM1.xlsx (there are also some other .xlsx files in here)
the end goal would be the have all excel data for each subfolder combined into one table.
I'm sorry I have no code, I've tried using subdir and dir and have hade no success. If anyone can help I would apreciate it.
0 commentaires
Réponses (1)
Bob Thompson
le 11 Juin 2019
There are two ways of doing this. If you have a more modern version of Matlab (2016b+ I believe) you can use the dir command.
files = dir('universalpath\**\GMM1.xlsx');
Alternatively, the community has written several codes which can be used to accomplish the task. I have used findfiles.m in the past. It can be found here.
https://www.mathworks.com/matlabcentral/fileexchange/57298-recursively-search-for-files
0 commentaires
Voir également
Catégories
En savoir plus sur File Operations 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!