Page 1 of 1

how to order 10 numbers by size?

Posted: Sun Jun 21, 2015 5:03 am
by hyperion007
Let's say I want to read 10 sample values from a sensor and sort them by size and store them in that order from low to high in variable01, variable02, variable03... variable10.
How would you suggest I do this? I want to make sure I do it efficiently and don't do a lot of unnecessary calculations.

Re: how to order 10 numbers by size?

Posted: Sun Jun 21, 2015 9:19 am
by medelec35
Hi Daniel,
Attached is an old bubble sort flowchart I created a while ago.
Although sorting 12 numbers, can easily be adapted for 10.
The variables are contained within an array.
If you require any further help then just post your flowchart.

Martin

Re: how to order 10 numbers by size?

Posted: Sun Sep 13, 2015 9:52 pm
by medelec35
Hi Daniel,
Did the bubble sort work ok for your application?

Re: how to order 10 numbers by size?

Posted: Sat Sep 19, 2015 5:14 pm
by hyperion007
Thanks, I have not had time to check back on this. I wanted a simple way of identifying outliers in an array of say 10 byte variables to get a more accurate way of determining an average value.