How do I utilize a function with multiple outputs within another function?
I’m ranking values within columns of an array (descending), where the final output is an array with each value’s rank in the same position as the original value. I’m able to do this with multiple lines of code as follows:
[~,DR] = sort(vals,’descend’); % DR: index of values in descending order
[~,valsDRank] = sort(DR,’ascend’); % valsDRank: ranks in array position of original value
I’m curious how to accomplish this using a nested sort command in one line of code due to the multiple outputs of the sort function?
Thanks!I’m ranking values within columns of an array (descending), where the final output is an array with each value’s rank in the same position as the original value. I’m able to do this with multiple lines of code as follows:
[~,DR] = sort(vals,’descend’); % DR: index of values in descending order
[~,valsDRank] = sort(DR,’ascend’); % valsDRank: ranks in array position of original value
I’m curious how to accomplish this using a nested sort command in one line of code due to the multiple outputs of the sort function?
Thanks! I’m ranking values within columns of an array (descending), where the final output is an array with each value’s rank in the same position as the original value. I’m able to do this with multiple lines of code as follows:
[~,DR] = sort(vals,’descend’); % DR: index of values in descending order
[~,valsDRank] = sort(DR,’ascend’); % valsDRank: ranks in array position of original value
I’m curious how to accomplish this using a nested sort command in one line of code due to the multiple outputs of the sort function?
Thanks! value rank MATLAB Answers — New Questions