Loop through csv file names and sum columns

3 visualizaciones (últimos 30 días)
Damith
Damith el 10 de Mzo. de 2015
Respondida: dpb el 10 de Mzo. de 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.

Respuesta aceptada

dpb
dpb el 10 de Mzo. de 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.

Más respuestas (0)

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by