Not enough input arguments

1 view (last 30 days)
zamire ali
zamire ali on 16 Apr 2015
Edited: Jan on 16 Apr 2015
Im running this code in matlab and i get not enough input arguments for the second line
[m n] = size(coef)
anyone know why this is and how it can be solved?
code
function Y = spatFilt(x, coef, dimm)
[m n] = size(coef)
%check for valid dimensions
if(m<dimm)
disp('Cannot reduce to a higher dimensional space!');
return
end
%instantiate filter matrix
Ptild = zeros(dimm,n);
%create the n-dimensional filter by sorting
i=0;
for d = 1:dimm
if(mod(d,2)==0)
Ptild(d,:) = coef(m-i,:);
i=i+1;
else
Ptild(d,:) = coef(1+i,:);
end
end
%get length of input signal
T = length(x);
%instantiate output matrix
Y=zeros(dimm,T);
%filtering
for d = 1:dimm
for t = 1:T
Y(d,t) = dot(Ptild(d,:),x(:,t));
end
end
return
  3 Comments
zamire ali
zamire ali on 16 Apr 2015
hi when i run the code this message appears
>> spatFilt Error using spatFilt (line 15) Not enough input arguments.
Jan
Jan on 16 Apr 2015
I'd expect that there are some further lines in the message.

Sign in to comment.

Answers (1)

Jan
Jan on 16 Apr 2015
Did you create a function called "size" by your own? See:
which('size', '-all')
  2 Comments
zamire ali
zamire ali on 16 Apr 2015
no your right i havnt given size any parameters would you sggest using which('size', '-all') as the parameter
Jan
Jan on 16 Apr 2015
Edited: Jan on 16 Apr 2015
No. You description sounds like this command failes:
[m, n] = size(coef);
Matlab's original size command is satsified with one input. Then you might have created another function called "size", which requires more inputs. Then the output of "which('size', '-all')" would reveal all functions files which are called "size.m".
Or the complete error message might reveal, that coef is a function handle and not an array, such that size(coef) calls the function stored in coef but without any arguments.
Therefore I ask again for posting everything which appears in the command window, when the error occurs.
Please post also how you call the function spatFilt.

Sign in to comment.

Categories

Find more on Get Started with MATLAB 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!