How can I Insert a CSV filename into my array
Mostrar comentarios más antiguos
Need help with preparing data.
I'm creating an array by appending 500 csv files of daily stock data (varying rows), each with 7-columns using with code below.
How can I create an 8th column with the filename (or just part of the filename) so I can later identify which file belongs with which rows of data?
Thanks.
dname='C:\project\';
alldata=[];
files=dir([dname,'*.csv']);
for i=1:length(files);
csvdata=csvread([dname,files(i).name]);
alldata=[alldata;csvdata];
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre String Parsing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!