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 comentario

Star Strider
Star Strider el 19 de Ag. de 2014
Editada: Star Strider el 19 de Ag. de 2014
What line are you referring to?
By my count, Line 7 is:
hour_counter=0;

Iniciar sesión para comentar.

 Respuesta aceptada

Guillaume
Guillaume el 19 de Ag. de 2014

0 votos

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 comentarios

Image Analyst
Image Analyst el 19 de Ag. de 2014
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 el 19 de Ag. de 2014
Sorry Error is at Line 6....min_counter
Guillaume
Guillaume el 19 de Ag. de 2014
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 el 19 de Ag. de 2014
Exactly Prerna. That's what we're saying. Rename input everywhere you see it to inputArray or something and try again.

Iniciar sesión para comentar.

Más respuestas (1)

Doganay Karatas
Doganay Karatas el 14 de Nov. de 2020

0 votos

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

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 19 de Ag. de 2014

Respondida:

el 14 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by