Accidentally overrode 'filter' function, how can I get it back?

조회 수: 9 (최근 30일)
Blair Armstrong
Blair Armstrong 2019년 4월 3일
답변: Star Strider 2019년 4월 3일
I accidentally overrode the 'filter' function by making a user defined function also named 'filter'.
I tried to clear it by doing
builtin('function')
but that just got me an error:
'Error using filter
Not enough input arguments.'
How can I make sure I have the builtin 'filter' function back?

답변 (1개)

Star Strider
Star Strider 2019년 4월 3일
It’s probably still there.
first run this line from a script or your Command Window:
which filter -all
When I ran it, I got:
built-in (C:\Program Files\MATLAB\R2019a\toolbox\matlab\datafun\filter)
filter is a Java method % Shadowed java.util.Locale method
filter is a built-in method % Shadowed connector.internal.LoggerLevel method
filter is a built-in method % Shadowed matlab.lang.OnOffSwitchState method
filter is a built-in method % Shadowed matlab.internal.lang.capability.Capability method
C:\Program Files\MATLAB\R2019a\toolbox\matlab\bigdata\@tall\filter.m % Shadowed tall method
C:\Program Files\MATLAB\R2019a\toolbox\simulink\simulink\@SigLogSelector\filter.m % Shadowed SigLogSelector method
C:\Program Files\MATLAB\R2019a\toolbox\fixedpoint\fixedpointtool\@fxptui\filter.m % Shadowed fxptui method
C:\Program Files\MATLAB\R2019a\toolbox\matlab\timeseries\@timeseries\filter.m % Shadowed timeseries method
Then try it with an example from the documentation for filter and see if it still works (after you rename your function named ‘filter’ to something that doesn’t ‘overshadow’ the builtin function).

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by