Loop through csv file names and sum columns

15 ビュー (過去 30 日間)
Damith
Damith 2015 年 3 月 10 日
回答済み: dpb 2015 年 3 月 10 日
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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by