Divide higher to lower value column wise in matrix
2 次查看(过去 30 天)
显示 更早的评论
Could you please help me to find a way of how to divide values in 2*n matrix column wise so that i divide higher to lower number in every row. Thank you for any help!
0 个评论
回答(1 个)
Image Analyst
2014-8-31
Try this:
m=rand(2, 10) % Sample data.
% Sort to put the biggest number in the top row.
m_sorted = sort(m, 1, 'descend')
% Do the division.
ratios = m_sorted(1,:) ./ m_sorted(2,:)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!