Find max value with multiple conditions
Ältere Kommentare anzeigen
How can I find max value with 2 or more conditions (such as maxifs in excel).
Thanks before
6 Kommentare
darova
am 15 Jan. 2020
You should attach more details, example
Mohammad Sami
am 16 Jan. 2020
If your data is table, create a grouping variable in your data. Then use the function groupsummary.
Anita Fitriani
am 16 Jan. 2020
Anita Fitriani
am 16 Jan. 2020
Andrei Bobrov
am 16 Jan. 2020
Please attach small part of your excel-file or data table as MATLAB variable - 'table' in mat -file.
Anita Fitriani
am 16 Jan. 2020
Akzeptierte Antwort
Weitere Antworten (1)
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));
Kategorien
Mehr zu Data Type Identification finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
