Find max value with multiple conditions
25 ビュー (過去 30 日間)
古いコメントを表示
Anita Fitriani
2020 年 1 月 15 日
コメント済み: Auwal Adamu Abdullahi
2021 年 8 月 1 日
How can I find max value with 2 or more conditions (such as maxifs in excel).
Thanks before
6 件のコメント
Andrei Bobrov
2020 年 1 月 16 日
Please attach small part of your excel-file or data table as MATLAB variable - 'table' in mat -file.
採用された回答
Andrei Bobrov
2020 年 1 月 16 日
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]);
3 件のコメント
Auwal Adamu Abdullahi
2021 年 8 月 1 日
How do i obtain and tabulate the maximum wave height. Add to that table two separate columns that show the direction and period of each of those yearly maximum wave heights. for 30 years?
その他の回答 (1 件)
CAM
2020 年 1 月 16 日
編集済み: CAM
2020 年 1 月 16 日
Use logic statements for each criterion. Use logical "AND" (&) to see which elements meet all criteria. Find the max of those values.
Air Code (untested):
idxC1 = (matrix > criterion1);
idxC2 = (matrix < criterion2);
...
idxOverall = idxC1 & idxC2 & ... & idxCn;
MaxVal = max(matrix(idxOverall));
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!