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

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

采纳的回答

Image Analyst
Image Analyst 2013-5-3
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 个评论
Francisco Angel
Francisco Angel 2013-5-3
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 :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by