MatLab Sortrows if statement is true -
i want sort table simple condition. if 3 of 5 vectors in group >0 put row on top of table.
i tried sortrow cant implement condition.
the concrete case want solve table consists of 11 columns. first column shows names assocciated values in rows respectively. rest of columns splitted 2 groups example a1:a5 , b1:b5. if in group 3 of 5 cells >0 put row on top of table. first row should logically row every value >0.
i tried many things including combination of sortrows , if statements didnt work.
maybe have idea. thank much.
if understand correctly, want make sure rows on top values in columns 2-6 positive.
here's solution using sort
:
tbl = ... %# table numpositive = sum(tbl(:,2:6)>0,2); [~,sortidx] = sort(numpositive,'descend'); sortedtable = tbl(sortidx,:);
Comments
Post a Comment