I am getting Error: Not enough input arguments at Line 6 in this code. Can someone please help me with me with this.
function result = fix_ripe(input)
%%%%
%%This function fill the empty minuties with 0's for all the columns for
%%that miniee
%%%%
min_counter=input(1,3);%first miniute from the first pin
hour_counter=0;
missing_index=-1;
diff=-1;
for i=1:length(input)
if(input(i,3)~=min_counter)
if(input(i,3)<input(i-1,3))
diff(end+1)=60+input(i,3)-input(i-1,3)-1;
else
diff(end+1)=input(i,3)-input(i-1,3)-1;
end
missing_index(end+1)=i;
min_counter=input(i+1,3);
% if(min_counter<59)%min
% min_counter=min_counter+2;
% else %hours
% min_counter=1;
% if(hour_counter<23)
% hour_counter=hour_counter+2;
% else
% hour_counter=1;
% end
% end
else
if(min_counter<59)%min
min_counter=min_counter+1;
else %hours
min_counter=0;
if(hour_counter<23)
hour_counter=hour_counter+1;
else
hour_counter=0;
end
end
end
end
missing_index=missing_index(2:end);
missing_index=missing_index-1;
diff=diff(2:end);
% result=-1;
% found=0;
% for i=1:length(input)
% if(ismember(i,missing_index))
% result(end+1)=0;
% found=found+1;
% else
% result(end+1)=input(i-found,3);
% end
%
% end
% result=result(2:end);
result=input;
for o=1:length(missing_index)
temp=[result(missing_index(o))+1,0,0,0,...
result(missing_index(o),5),...
result(missing_index(o),6),...
result(missing_index(o),7),...
result(missing_index(o),8),...
result(missing_index(o),9),...
result(missing_index(o),10),...
result(missing_index(o),11),...
result(missing_index(o),12),...
result(missing_index(o),13),...
result(missing_index(o),14),...
result(missing_index(o),15),...
result(missing_index(o),16),...
result(missing_index(o),17),zeros(24,1)'... 38 column
];%17 columns
% temp=[0,0,0,0,0,0,0,0,0,0,0];
for p=1:diff(o)
result=[result(1:missing_index(o),:); temp; result(missing_index(o)+1:end,:)];
end
missing_index(o+1:end)=missing_index(o+1:end)+diff(o);
end
if(min_counter~=0 && length(result(:,1))~=1440)%to solve the updates pins that does not start with 0
limit_left=input(1,3);
limit_right=input(end,3);
for u=1:(limit_left-limit_right-1)
temp=[input(end,1)+u,0,limit_right+1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,zeros(24,1)'];%17 columns
result(end+1,:)=temp;
end
end
end

댓글 수: 1

Star Strider
Star Strider 2014년 8월 19일
편집: Star Strider 2014년 8월 19일
What line are you referring to?
By my count, Line 7 is:
hour_counter=0;

댓글을 달려면 로그인하십시오.

 채택된 답변

Guillaume
Guillaume 2014년 8월 19일

0 개 추천

Which is line 7? By my count it would be hour_counter = 0 but that line can't generate the error you mention.
Provide the right number of arguments to whichever function you're calling on the line where you're getting the error
On a side note, do not name your variables input or diff as these are the names of some matlab built-in functions. It will only cause you a lot of grief in the future if you keep these names.

댓글 수: 4

Image Analyst
Image Analyst 2014년 8월 19일
That's the first thing that struck me. Having input (a built in function that waits for users to type in something) as an input argument is really asking for trouble.
Prerna Batta
Prerna Batta 2014년 8월 19일
Sorry Error is at Line 6....min_counter
Guillaume
Guillaume 2014년 8월 19일
Rename your input variable to something more meaningful that isn't also a matlab function (and also rename your diff variable). If the error persists, copy-paste the entire error message here.
Image Analyst
Image Analyst 2014년 8월 19일
Exactly Prerna. That's what we're saying. Rename input everywhere you see it to inputArray or something and try again.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Doganay Karatas
Doganay Karatas 2020년 11월 14일

0 개 추천

Error using fill
Not enough input arguments.
Why do i get this error??
HERE IS MY CODE
t=0:pi/50:2*pi;
figure(1)
plot(t,sin(t))
figure (2)
fill (t,sin(t)),('g')
figure (3)
stairs (t,sin(t))
figure (4)
bar (t,sin(t))
end

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

질문:

2014년 8월 19일

답변:

2020년 11월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by