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

조회 수: 2 (최근 30일)
Francisco Angel
Francisco Angel 2013년 5월 3일
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