フィルターのクリア

Averaging different text files according to there month and year

1 回表示 (過去 30 日間)
Michael Lauria
Michael Lauria 2018 年 11 月 21 日
コメント済み: Michael Lauria 2018 年 11 月 21 日
I have serveral text files (around 100) contating data from different months of different years.
Example File
Year-Month-Data
1992 9 353.07
1992 10 359.88
1992 11 361.09
1992 12 360.35
Not every file matches the start and end date of the other (ie. some files start in 1969 and other in 2000...etc). But I still want to average the data of each corresponding month of the matching year.
~If 1992 (year) 9 (month) then average coresponding data value.
If the file has no matching month or year then the loop simply skips over it.
Would anyone know where to start here?
Many Thanks

採用された回答

Cris LaPierre
Cris LaPierre 2018 年 11 月 21 日
編集済み: Cris LaPierre 2018 年 11 月 21 日
I'd look into the datetime data time, as well as loading the data into a table.
The datetime data type "understands" the concept of year, month, etc., which should simplify selecting a month's worth of data to average. You even have the potential to do it in just a couple lines of code using findgroups and splitapply functions.
  1 件のコメント
Michael Lauria
Michael Lauria 2018 年 11 月 21 日
I will look into it and get back to you.
Many Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by