Loop through csv file names and sum columns

1 次查看(过去 30 天)
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.

采纳的回答

dpb
dpb 2015-3-10
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by