Median for Stream of Lists

frank desben's icon

Hi all,
I'd like to calculate the median of a stream of lists.
by that I mean:
I have a continuous flow of lists (of say length 5) coming in.
Now I'd like to calculate the median for each position (compared to the previous lists at the same position).
So I don't want to calculate the median for one single list but basically as many medians as my lists are long.

E.g.
a median window size of 3 and a list length of 3:

List 1: 1 2 1
List 2: 1 2 2
List 3: 0 2 3

Should output:
Result: 1 2 2

I hope I made this clear.

This actually seems like a very basic thing but I just can't find an external or abstraction for this.

Does anybody know of one?

All the best

Frank

frank desben's icon

Hi all,
ok I had a go at it using scripting,
I'm pretty sure that's not the fastest way to do it though.

Max Patch
Copy patch and select New From Clipboard in Max.

this is the abstraction:
save as: "median-list-scripting"

Max Patch
Copy patch and select New From Clipboard in Max.

this is the "help-file":

Any modifications or faster alternatives are welcome!

Best Frank

andrea agostini's icon
Max Patch
Copy patch and select New From Clipboard in Max.

quick and easy with bach - www.bachproject.net ;)

aa