Can anyone help me to spot the error and how to solve it?

1 次查看(过去 30 天)
Error in OPT_LEACH (line 279)
plot([r r+1],[STATISTICS(r+1).AVG STATISTICS(r+2).AVG],'red');
Error using plot
Vectors must be the same lengths.
And here is the function of error:
figure(3);
for r=0:1:300
ylabel('Average Energy of each Node');
xlabel('Round Number');
plot([r r+1],[STATISTICS(r+1).AVG STATISTICS(r+2).AVG],'red');
hold on;
end

回答(2 个)

Jan
Jan 2017-4-9
I guess that STATISTICS(r+1).AVG or STATISTICS(r+2).AVG is not a scalar.
  2 个评论
Jan
Jan 2017-4-12
@Ayan: I cannot guess what you want to achieve, therefore I cannot suggest any changes.

请先登录,再进行评论。


utsav kakkad
utsav kakkad 2018-11-5
Hey I am having the same error and using STATISTICS(r+1).avg How did you solve it ?

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by