Undefined function or method 'filter'

4 次查看(过去 30 天)
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...

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by