Yearly maximum of a dataset

조회 수: 4 (최근 30일)
Murielle van Pampus
Murielle van Pampus 2022년 1월 6일
댓글: Murielle van Pampus 2022년 1월 6일
Hi,
Using a large dataset, I have to determine the yearly maximum value. As the dataset is a table, the function retime doesn't seem te work. Can any of you help me with which function should work?
clear; clc; close all;
filename = 'data_1981_2020_FH';
Data1 = readtable(filename,'PreserveVariableNames',true);
Data1(:,1)=[]; % Remove the 1st column
Data1.YYYYMMDD=datetime(string(Data1.YYYYMMDD),'InputFormat','yyyyMMdd'); % Convert to datetime format
Gmean=groupsummary(Data1,"YYYYMMDD",'day',"mean"); % Calculate daily mean
Gmean.GroupCount=[]
Gmean.mean_HH=[]
%Gmax=groupsummary(Data1,"YYYYMMDD",'year',"max");
TT2_data_year = retime(Gmean,'yearly','max')
%tsmax = max(Data1,'mean_FH','year')
%YrMean = retime(Gmean, 'yearly', 'max'); % Yearly Maximum
%Max = [YrMean.Times.Year YrMean.mean_FH]
  댓글 수: 2
Simon Chan
Simon Chan 2022년 1월 6일
Did you try my reply on your previous question?
G2 = groupfilter(Data1,'YYYYMMDD','year',@(x) x==max(x),'FH')
Murielle van Pampus
Murielle van Pampus 2022년 1월 6일
Thank you, this works perfect! Thank you so mucht :)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by