Loop through csv file names and sum columns

조회 수: 3 (최근 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개)

카테고리

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