Having Matlab run different files sequentially.
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ok, so I have a folder full of excel files, each file with a different name. I also wrote a program to analyze the data. I thought about manually changing the xls read command to suite the name of the file, but then I was thinking "there has to be a way for matlab to run through these files sequentially." Anyone know how to do that? Keep in mind that all of the files have different names. I would be willing to go back and change the file names to suite matlab a little better, but the gists of the thing is that I want matlab to load the file, run the program, save the data the program is supposed to extract and then move on to the next file in the sequence. Also keep in mind that I need to save the extracted data from every file. I don't want the data to go away every time a new file runs. Thanks in advance.
0 Commenti
Risposta accettata
Oleg Komarov
il 1 Ago 2011
% Retrieve files in directory by extension
s = dir('C:\Users\Oleg\Desktop\*.xlsx');
% Loop over the files
names = {s.name};
for n = 1:numel(names)
xlsread(['C:\Users\Oleg\Desktop\' names{n}])
% do stuff
end
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!