In Quiver Function Error: " index must be a positive integer or logical."
이전 댓글 표시
Hey,
I get the error
??? Attempted to access quiver(2.76604,2.17365,-0.123257,0.81116); index must be a positive integer or logical.
and can't imagine why, because if I type quiver(2.76604,2.17365,-0.123257,0.81116) in the Command Window it works well.
Here is the Code:
for k=1:n
for l=1:n
if E(k,l) >= 1
x1=2+cos(2*pi/n*k); x2=2+cos(2*pi/n*l); y1=2+sin(2*pi/n*k); y2=2+sin(2*pi/n*l);
u=y1-x1; v=y2-x2;
quiver(x1,x2,u,v);%,'Color',color,'LineWidth',2);
end
end
end
with n=length(E) and E(i,j) = 1 if there excists an arrow between i and j
Thank You Daniel
댓글 수: 3
David Sanchez
2013년 8월 13일
I run the following code and it worked for me:
n=3;
for k=1:n
for l=1:n
x1=2+cos(2*pi/n*k);
x2=2+cos(2*pi/n*l);
y1=2+sin(2*pi/n*k);
y2=2+sin(2*pi/n*l);
u=y1-x1;
v=y2-x2;
quiver(x1,x2,u,v);
end
end
Is the code you presented the one that yields the error?
Daniel
2013년 8월 13일
Daniel
2013년 8월 13일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!