How to order a set of data from highest to lowest or lowest to highest?using FOR

2 views (last 30 days)
I have to order a set of data from highest to lowest or lowest to highest using the FOR random data can be I can not use the max command
Thanks for your help

Answers (2)

John D'Errico
John D'Errico on 12 Jan 2012
Don't you think you should be doing your own homework? Really, you gain more by doing it yourself.
Ok. Just this once, I'll do it for you. This solution employs for but not max.
for i = 1:1
M = sort(dataset(:),'ascend');
end
Enjoy. I'll let you figure out how to do it in descending order.

Walter Roberson
Walter Roberson on 12 Jan 2012

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!