Undefined function or variable 'ordf'.
4 views (last 30 days)
Show older comments
I want to use medfilt2 inside a function, but when I run the code it always gives me that error message saying it is undefined. Could someone give suggestions on how to solve it? Thanks!
2 Comments
Geoff Hayes
on 22 Oct 2016
Yan - how does calling the medfilt2 generate the error concerning ordf? Please show some of the code that generates this error and copy and paste the full error message to your question.
Walter Roberson
on 23 Oct 2016
I searched through all of the Mathworks-supplied .m files I have installed in my R2016b installation, and do not find any occurrences of a variable named ordf, so it sounds like the difficulty is in code you (or a third-party toolbox) have supplied.
Answers (1)
Yan Gong
on 11 Jan 2017
Edited: per isakson
on 11 Jan 2017
1 Comment
per isakson
on 11 Jan 2017
Run
dbstop if error
B=medfilt2(A,[3 3],'symmetric');
and try to understand what's going on.
On my R2016a it seems to work fine
>> dbstop if error
A=[1 3 3 5 1;0.5 3 0 9 2;1 1 1 1 1;0.4 1.9 24 3.2 5;0 -1 2.7 30 5];
B=medfilt2(A,[3 3],'symmetric');
B
B =
1.0000 3.0000 3.0000 3.0000 2.0000
1.0000 1.0000 3.0000 1.0000 1.0000
1.0000 1.0000 1.9000 2.0000 2.0000
0.4000 1.0000 1.9000 3.2000 5.0000
0 0.4000 2.7000 5.0000 5.0000
>> version
ans =
9.0.0.341360 (R2016a)
In R2016a the code is different; line 82-90 of c:\Program Files\MATLAB\R2016a\toolbox\images\images\ordfilt2.m reads
if isempty(s)
%ORDFILT2(A,ORDER,DOMAIN)
B = ordfilt2mex(A, order, offsets, [padSize padSize] + 1, ...
originalSize, domainSize);
else
%ORDFILT2(A,ORDER,DOMAIN,S,PADOPT)
B = ordfilt2mex(A, order, offsets, [padSize padSize] + 1, ...
originalSize, domainSize, s);
end
See Also
Categories
Find more on Digital Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!