Not enough input arguments.
14 ビュー (過去 30 日間)
古いコメントを表示
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
2014 年 8 月 19 日
編集済み: Star Strider
2014 年 8 月 19 日
What line are you referring to?
By my count, Line 7 is:
hour_counter=0;
採用された回答
Guillaume
2014 年 8 月 19 日
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 件のコメント
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
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
2020 年 11 月 14 日
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
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!