Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

index exceeds matrix demension

조회 수: 1 (최근 30일)
PetronasAMG
PetronasAMG 2018년 2월 3일
마감: MATLAB Answer Bot 2021년 8월 20일
figure(1)
hold on;
plot(1.25,1.25,'ro');
i=1;
while i <= 20
plot([xi(i),xj(i)],[yi(i),yj(i)],'b');
i= i+1
end
title('graph')
grid;
box;
ax = gca;
ax.YAxisLocation = 'origin';
keep on getting index exceeds matrix demension... could you please help??
  댓글 수: 2
Jan
Jan 2018년 2월 4일
Please post the complete error message. Then the readers do not have to guess, where the error occurs. Without your input data, we cannot guess, which variable is affected. But it could even be a redefining of "title" as a variable.
Walter Roberson
Walter Roberson 2018년 2월 4일
Note that when i becomes 2, then xi(i) will not refer to a variable named x2: it will continue to refer to a variable xi

답변 (1개)

Image Analyst
Image Analyst 2018년 2월 4일
Your 4 vectors have a length less than 20. Before the loop put this, and you'll see (in the command window)
size(xi)
size(xj)
size(yi)
size(yj)
Do they all go up to 20? No, evidently not or you wouldn't be getting an error message. If you still need help, attach your xi, xj, yi, and yj.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by