필터 지우기
필터 지우기

Index in position 2 exceeds array bounds (must not exceed 1).?

조회 수: 5 (최근 30일)
ismail alakel
ismail alakel 2022년 3월 28일
댓글: Image Analyst 2022년 3월 29일
hello
i made code
t=robot.fkine( th1 th2 th3);
g= t(1,4);
then show error
Index in position 2 exceeds array bounds (must not exceed 1).
how i can solve it
  댓글 수: 6
ismail alakel
ismail alakel 2022년 3월 29일
how i can get only value 18

댓글을 달려면 로그인하십시오.

답변 (2개)

Star Strider
Star Strider 2022년 3월 28일
I am not certain what ‘t’ is.
However it appears to be a column vector, so the second index is not appropriate for it.
t = rand(5,1)
t = 5×1
0.2687 0.8310 0.7643 0.9909 0.8982
g = t(1,1)
g = 0.2687
g = t(1,4)
Index in position 2 exceeds array bounds. Index must not exceed 1.
.
  댓글 수: 4
Image Analyst
Image Analyst 2022년 3월 29일
He claims t is 3 by 4.
Star Strider
Star Strider 2022년 3월 29일
The error indicates that is not reality.
However I get the feeling that this could require the Robotics Toolbox or some other function I don’t have.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2022년 3월 28일
편집: Image Analyst 2022년 3월 28일
What does this show:
t = robot.fkine(th1 th2 th3);
size(t) % Do NOT use a semicolon here!
g = t(1, 4);
If t is an N-by-1 column vector, try
g = t(4);
Actually that should work for either a row vector or a column vector.
  댓글 수: 7
ismail alakel
ismail alakel 2022년 3월 29일
how i can get value 18 only
Image Analyst
Image Analyst 2022년 3월 29일
t = rob.fkine([0 0 0 0 0])
value = t(1, 4);

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by