MATLAB: Find max value with multiple conditions

conditionifmax

How can I find max value with 2 or more conditions (such as maxifs in excel).
Thanks before

Best Answer

T=readtable('wave height data.xlsx');
[r,rn] = findgroups(T(:,1));
[c,cn] = findgroups(T(:,2));
out = accumarray([r,c],T.WaveHeight,[],@max);
Tout = array2table([rn.Year,out],'VariableNames',[{'Year'};cn.Direction]);