Trying to create an array of Matrices

조회 수: 4 (최근 30일)
Ian Phillips
Ian Phillips 2012년 11월 9일
댓글: omar tayyab 2021년 3월 16일
I'm trying to create multiple matrices by iterating values through a constant matrix.
I'm getting this error:
In an assignment A(I) = B, the number of elements in B and I must be the same.
The code I have is:
% T = [q(1) q(2) q(3) q(4) q(5)];
% A = [a2(1) 0 0 a2(2) 0];
% a = [0 l(2) l(3) 0 0];
% d = [l(1) 0 0 0 l(4)];
% for i = 1:5
% t(i) = [ cos(T(i)) -sin(T(i))*cos(A(i)) sin(T(i))*sin(A(i)) a(i)*cos(T(i))
% sin(T(i)) cos(T(i))*cos(A(i)) -cos(T(i))*sin(A(i)) a(i)*sin(T(i))
% 0 sin(A(i)) cos(A(i)) d(i)
% 0 0 0 1 ] ;
% end
What is it I'm doing wrong?

채택된 답변

Matt Fig
Matt Fig 2012년 11월 9일
Use
t{i}
instead of
t(i)
  댓글 수: 2
Ian Phillips
Ian Phillips 2012년 11월 9일
편집: Matt Fig 2012년 11월 9일
That simple? Thanks. Feel extra stupid now.
omar tayyab
omar tayyab 2021년 3월 16일
haha. Your not alone

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by