Undefined function or method 'filter'

조회 수: 6 (최근 30일)
Mani
Mani 2012년 6월 27일
댓글: Walter Roberson 2017년 1월 9일
hi i am getting an error in this code
% function y = filtdn(x, f, dim, extmod, shift)
% FILTDN Filter and downsample (by 2) along a dimension
%
% y = filtdn(x, f, dim, extmod, shift)
%
% Input:
% x: input signal
% f: 1-D filter
% dim: the processing dimension
% extmod: extension mode (e.g. 'per' or 'sym')
% shift: specifies the window over which filtering occurs
%
% Output:
% y: filtered and dowsampled signal
%
% Note:
% The origin of the filter f is assumed to be floor(size(f)/2) + 1.
% Amount of shift should be no more than floor((size(f)-1)/2).
% Skip singleton dimension
if size(x, dim) == 1
y = x;
return
end
% Cell array of indexes for each dimension
nd = ndims(x);
I = cell(1, nd);
for d = 1:nd
I{d} = 1:size(x,d);
end
% Border extend
n = size(x, dim);
hlf = (length(f) - 1) / 2;
% Amount of extension at two ends
e1 = floor(hlf) + shift;
e2 = ceil(hlf) - shift;
switch extmod
case 'per'
I{dim} = [ly-e1+1:n , 1:n , 1:e2];
case 'sym'
I{dim} = [e1+1:-1:2 , 1:n , n-1:-1:e2];
otherwise
error('Invalid input for EXTMOD')
end
y = x(I{:});
% Filter, downsample, and return only the 'valid' part
y = filter(f, 1, y, [], dim);
I{dim} = (1:2:n) + length(f) - 1;
y = y(I{:});
and the error is ??? Undefined function or method 'filter' for input arguments of type 'uint8'.
Error in ==> filtdn at 54 y = filter(f, 1, y, [], dim);
Filter is an inbuilt function and i have image processing toolbox installed and set in my preferrence ...
can anyone help me with this???
  댓글 수: 2
rani krithiga
rani krithiga 2017년 1월 9일
can you tell me parameters for all functions in lpdemo.m
Walter Roberson
Walter Roberson 2017년 1월 9일
rani krithiga,
Are you asking about https://www.mathworks.com/matlabcentral/fileexchange/9868-laplacian-pyramid-toolbox/content/lpdemo.m ?? That would not appear to have anything to do with the current Question; please open a new Question about that. Did you look at the comments in the source code for each function?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 27일
filter() does not accept arguments of datatype uint8(). You need to filter a single precision or double precision value.

추가 답변 (2개)

Andreas Goser
Andreas Goser 2012년 6월 27일
This likely is an overload of multiple FILTER commands. Try
which filter -all
In my installation, it returns:
built-in (C:\Program Files\MATLAB\R2012a\toolbox\matlab\datafun\@single\filter) % single method
built-in (C:\Program Files\MATLAB\R2012a\toolbox\matlab\datafun\@double\filter) % double method
C:\Program Files\MATLAB\R2012a\toolbox\simulink\simulink\@SigLogSelector\filter.m % SigLogSelector method
C:\Program Files\MATLAB\R2012a\toolbox\comm\comm\@gf\filter.m % gf method
C:\Program Files\MATLAB\R2012a\toolbox\comm\comm\@channel\filter.m % channel method
C:\Program Files\MATLAB\R2012a\toolbox\econ\econ\@LagOp\filter.m % LagOp method
C:\Program Files\MATLAB\R2012a\toolbox\dsp\filterdesign\@mfilt\filter.m % mfilt method
C:\Program Files\MATLAB\R2012a\toolbox\dsp\filterdesign\@adaptfilt\filter.m % adaptfilt method
C:\Program Files\MATLAB\R2012a\toolbox\finance\ftseries\@fints\filter.m % fints method
C:\Program Files\MATLAB\R2012a\toolbox\fixedpoint\fixedpointtool\@fxptui\filter.m % fxptui method
C:\Program Files\MATLAB\R2012a\toolbox\mbc\mbctools\@sweepsetfilter\filter.m % sweepsetfilter method
C:\Program Files\MATLAB\R2012a\toolbox\mbc\mbctools\@sweepset\filter.m % sweepset method
C:\Program Files\MATLAB\R2012a\toolbox\signal\signal\@dfilt\filter.m % dfilt method
C:\Program Files\MATLAB\R2012a\toolbox\matlab\timeseries\@timeseries\filter.m % timeseries method
Please see what is at the top for you and consider renaming.
  댓글 수: 1
Mani
Mani 2012년 6월 27일
hi ... thanks for the reply ....
if i want to use a filter of type FILTER(B,A,X,[],DIM) what do i do . It is a built in function
my installation returns
built-in (D:\Program Files\Matlab\toolbox\matlab\datafun\@single\filter) % single method
built-in (D:\Program Files\Matlab\toolbox\matlab\datafun\@double\filter) % double method
D:\Program Files\Matlab\toolbox\matlab\timeseries\@timeseries\filter.m % timeseries method
D:\Program Files\Matlab\toolbox\comm\comm\@gf\filter.m % gf method
D:\Program Files\Matlab\toolbox\comm\comm\@channel\filter.m % channel method
D:\Program Files\Matlab\toolbox\econ\econ\@LagOp\filter.m % LagOp method
D:\Program Files\Matlab\toolbox\filterdesign\filterdesign\@mfilt\filter.m % mfilt method
D:\Program Files\Matlab\toolbox\filterdesign\filterdesign\@adaptfilt\filter.m % adaptfilt method
D:\Program Files\Matlab\toolbox\finance\ftseries\@fints\filter.m % fints method
D:\Program Files\Matlab\toolbox\fixedpoint\fixedpointtool\@fxptui\filter.m % fxptui method
D:\Program Files\Matlab\toolbox\mbc\mbctools\@sweepsetfilter\filter.m % sweepsetfilter method
D:\Program Files\Matlab\toolbox\mbc\mbctools\@sweepset\filter.m % sweepset method
D:\Program Files\Matlab\toolbox\signal\signal\@dfilt\filter.m % dfilt method

댓글을 달려면 로그인하십시오.


Jan
Jan 2012년 6월 27일
The error message means, that f must not be a uint8 vector. Simply convert it to a double.
  댓글 수: 2
Mani
Mani 2012년 6월 27일
I am still getting the same error... do i have to convert vector y too???
Mani
Mani 2012년 6월 27일
thanks... your answer too helped me sort out the problem...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by