Importing multiple non numeric .txt files and assigning file name as variable
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
bugatti79
il 18 Ott 2013
Risposto: Walter Roberson
il 18 Ott 2013
Hi Folks,
I am trying to import multiple non numeric .txt files and assign each file name as variable. Here is some code but it is not working properly. Ie, it creates a 8 1*1 struct array containing the name, date bytes etc but not the actual numerical data. I suspect the last line is not correct...
files = dir('C:\Test\');
for i=3:size(files, 1)
DELIMITER = ',';
HEADERLINES = 1;
a = importdata(files(i).name, DELIMITER, HEADERLINES );
end
Any ideas? B
0 Commenti
Risposta accettata
Walter Roberson
il 18 Ott 2013
Assign to a{i-2} instead of to "a". What you have now will drop all but the last file's data.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Workspace Variables and MAT-Files 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!