Loop through csv file names and sum columns

1 visualizzazione (ultimi 30 giorni)
Damith
Damith il 10 Mar 2015
Risposto: dpb il 10 Mar 2015
Hi,
I need to loop through all the files in a folder for file names for year, month and day (for example, TRMM_1998_01_0100_newntcl.csv). Then, I need to sum column 3 for file names for example, 1998 01 01 from 00 to 21 (00,03,06,09,12,15,18,21).
Can somebody suggest me a way to do this?
See the attached csv file.
Thanks in advance.

Risposta accettata

dpb
dpb il 10 Mar 2015
See the FAQ at http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F, for your case the dir solution towards the end of the section is of particular interest.
Or, while I've not used it meself, given the trivial form of the files and the computation, look at the abstraction at the link thereon http://www.mathworks.com/matlabcentral/fileexchange/9723-FILEFUN:%20APPLY%20A%20FUNCTION%20TO%20FILES that handles the behind-the-scenes stuff for you.

Più risposte (0)

Categorie

Scopri di più su File Operations 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!

Translated by