Unexplainable (to me) "not enought input arguments error"

1 view (last 30 days)
Hello I am making a code that takes data and remove outliers, the data are read from a excel file, here is the code if true % code
function filtered=filter(vec)
%Contador para almacenar los datos del vector procesado
clear all
%%vec=xlsread('datos lab 4.xls','Hoja2','Q6:S2005');
i=1;
filtered(1,:)=vec(1,:);
i=i+1;
for j=2:length(vec(:,1))
if abs((vec(j,2)-vec(j-1,2))/vec(j-1,2))<1
filtered(i,:)=vec(j,:);
i=i+1;
end
end
end
end
The problem is when I try to call the function externally with the data (the line that reads the data is commented), I try uncommenting this line and modifying the code to turn it in a script and it works !!, but when I use It with exactly the same data in another script or the command line it says "not enought input argumentes"

Accepted Answer

Image Analyst
Image Analyst on 3 May 2013
How are you calling it on the command line? Did you first call xlsread to get "vec" and then say
filtered = filter(vec);
By the way, filter() is the name of a built-in function, so how do you know which version of filter function you're calling? Why don't you call your function something different?
  1 Comment
Francisco Angel
Francisco Angel on 3 May 2013
thanks, the function also works as a nested function, all because the same name with the built in function you mention, so I change the name and it works as an independent function :)

Sign in to comment.

More Answers (0)

Categories

Find more on 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!