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

조회 수: 8 (최근 30일)
Ayan Bakshi
Ayan Bakshi 2017년 4월 9일
답변: utsav kakkad 2018년 11월 5일
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
Ayan Bakshi
Ayan Bakshi 2017년 4월 10일
How to make it scalar or if there is alternative what it is.
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에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by