Is there a way to create a loop for reading multiple Excel files at once?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Morgan Illman
le 21 Nov 2022
Commenté : Morgan Illman
le 21 Nov 2022
I have a large number of excel files with the name of a sensor and then a time following the name: "PAR_TOP_230", "PAR_TOP_330", etc. to indicate the hour in which the sample was collected (the time always varies by one hour between samples). I was wondering if there is some way to make a loop that reads each excel file in order and extracts a single column of data from each file. I know how to use functions to import excel data, but I am unsure of how to refer to file names in a MATLAB for loop.
I was thinking something along the lines of the code below.
time=[130,230,330...];
for i= 1:length(time)
lum(:,i)=csvread('PAR_TOP_((time(i)).csv',3,2);
end
0 commentaires
Réponse acceptée
David Hill
le 21 Nov 2022
time=[130,230,330...];
for i= 1:length(time)
lum(:,i)=csvread(sprintf('PAR_TOP_%d.csv',time(i)),3,2);
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Import from MATLAB 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!