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.
how to order 10 numbers by size?
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: how to order 10 numbers by size?
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
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
- Attachments
-
- Bubble sort.fcf
- (11.5 KiB) Downloaded 481 times
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: how to order 10 numbers by size?
Hi Daniel,
Did the bubble sort work ok for your application?
Did the bubble sort work ok for your application?
Martin
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: how to order 10 numbers by size?
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.