Adds a new command called MedianFilter
Syntax
MedianFilter Array, Elements
Overview
Returns the median of the array by performing a bubble sort on the array and selecting the resulting middle element.
Operators
Array – any Byte array
Elements - a constant, or byte variable indicating the number of elements within the array to sort
Code:
Include "PROTON_4.inc"
Dim myarray[10] As Byte
Dim index As Byte
Dim temp As Byte
Seed $0345
For index = 0 To 9
temp = Random
myarray[index] = temp
HRSOut Dec temp,32
Next
HRSOut 10,13
temp = MedianFilter myarray, 10
HRSOut "the median of the array is ",Dec temp
Stop
Notes:
The array will be rearranged. Where the array is an even number the lower of the middle elements will returned.
Download module
Download: MedianFilter 

Menu
Recent Articles


Using PDS with SPI GLCD based on ST7565R Controller
Graphic LCDs based on the ST7565 are cheaper then GLCDs with other controllers. SPI requires only four pins. If the circuit