finding the maximum within a specific range
조회 수: 6(최근 30일)
for the attached table we would like to find the index of the max point of the variable NE8 within the range of (200,400) applied on the variable GDALT. This might be a simpel task and I am complicating it but if anyone can help.
Githin George 2022년 7월 25일
편집: Githin George 2022년 7월 25일
My understanding is that for rows having GDALT in range 200-400 you would like to find the row where NE8 is maximum.
Please see if this code helps
txt = readtable("table.txt");
% I'm adding an Index Column, in case you specifically want the index
txt.INDEX = (1:height(txt))';
subTable = txt(txt.GDALT >=200 & txt.GDALT <=400, :);
% getting idx in the subtable using max function
[~,idx] = max(subTable.NE8,,'omitnan');
% this row contains the required result. You can use the index from this
result = subTable(idx,:)
Hope this helps.