Help required for sorting
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!