Help required for sorting
显示 更早的评论
I have a table of size 17520X33 having multiple buyers' price and their required quantites.I want to arrange buyers based on price in desending order with ID. After arrange them in desending order i want to adjust their demand. Below is the segment of code which i am trying its arranges the prices well but the demand column is not adjusted accordingly. Any body can help me how i can do . Objective is arrange buyers based on prices indesending order than access their demands. Thanks
for i=1:17520
X(i,:)=buyer_price(i,:);
Y(i,:)=buyer_fl(i,:);
end
for i=1:17520
[sortedX(i,:), sortIndex(i,:)] = sort(X(i,:), 'descend');
sortedY=Y(sortIndexX);
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!