MATLAB: Rank matrix elements in descending order matrix rank sort descend Hi! I have a matrix from which I want the elements to be moved to a table where the elements are sorted via descending order. Can I do this using the av_output command? Or something else? Thanks! Best Answer Why not just use the sort() function?m=magic(5);% Sort columns in descending order.sorted_m = sort(m, 'descend') Related SolutionsMATLAB: Reorder Eigenvalues in Schur factorization (Descending order) Upon searching and trials, this worked. H = magic(10);[U,T]=schur(H);[~, i] = sort(ordeig(T));[~, j] = sort(i);[US, TS] = ordschur(U, T, j); MATLAB: Boxplot with descending median Use the sort index to change the order of columns in your data.% Create demo datarng('default')data = rand(8376, 35).*randi(100,1,35); % Compute median of each column med = median(data); % Sort the columns of data by descending median order[~, sortIdx] = sort(med,'descend'); dataDescend = data(:,sortIdx); % Plot the resultsboxplot(dataDescend)If you want to label the orginal column order, set(gca, 'XTick', 1:numel(med), 'XTickLabel', sortIdx)xlabel('Original column order') Related QuestionHow to sort sparse matrices in descending orderTiedrank in descending orderComputing frequency*rank
Best Answer