From: andy Lu on
I thought medfilt1 is equivalent to the special case of medfilt2.

m = 9
x = rand(20000,30);
tic
c2 = medfilt1(x,m);
toc
tic
c3=medfilt2(x, [m,1]);
toc
sum(abs(c2-c3))

but when m is even, the results are quite different.
Also, in general, medfilt2 is much faster than medfilt1.

Can anybody help explain what is going on? Any information is greatly apprecaited!


From: us on
"andy Lu" <luyi36(a)gmail.com> wrote in message <hitun5$gqp$1(a)fred.mathworks.com>...
> I thought medfilt1 is equivalent to the special case of medfilt2.
> Also, in general, medfilt2 is much faster than medfilt1.
>
> Can anybody help explain what is going on? Any information is greatly apprecaited!

a hint:

- MEDFILT2 -> ORDFILT2 -> ORDF, which is a mex file
- MEDFILT1 does the computation in a subroutine using a loop

us