Finding maximum of time series but each year is in the same column

11 ビュー (過去 30 日間)
Saara-Liis Lutsar
Saara-Liis Lutsar 2021 年 2 月 15 日
回答済み: Saara-Liis Lutsar 2021 年 2 月 22 日
I have years from 2011 to 2019 in the same column, each year has as many rows that there are days in that year. How do I find the maximum value for each year, when the data is in many columns from over 40 stations. Also, should all the date values be imported as text if yyyy/mm/dd hh:mm are all in different columns or should I make them into one?
How my data looks: (yyyy mm dd hh:mm)
2011 01 01 00:00 station1 station2 ...
2011 01 01 00:01 station1 station2 ...
...
2019 01 01 00:00 station1 ...
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 2 月 15 日
Are you looking at the maximum value per year between all of the days and all of the stations, or are you looking for the maximum value relative to each station?

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

回答 (2 件)

Gaurav Garg
Gaurav Garg 2021 年 2 月 22 日
Hi Saara,
Assuming that you need to find maximum value for each year for each station individually, you can use max function.
max ( A ( 1 : 4, : ) )
A is the matrix holding the data, 1 and 4 can be replaced by the row numbers for the respective year. For example, if the data for year 2011 are stored in the rows from 1 to 188, the function would be written as
max ( A ( 1 : 188, : ) )
This would return the maximum for each column (which in turn means, maximum for each station).
You can execute this function for each year.
Easy enough, you can calculate the maximum among the stations by using
max ( max ( A ( 1 : 188, : ) ) )

Saara-Liis Lutsar
Saara-Liis Lutsar 2021 年 2 月 22 日
Thank you for your answer!
I already found an answer to my question by using this:
TTmax = retime(tt,'yearly','max')
This gave me all the max values for each year in each station. Perhaps you know how to use this code and also get the corresponding time stamps too?

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by