0

我想将它的输出保存不同的变量中,例如矩阵A1A2A3

B:matrix([0,-%pi/2,theta[1],0],[0,%pi/2,0,d[2]],[a[3],0,theta[3],0]);

D:matrix_size(B);

for i: 1 step 1 thru D[1] do
display(A:matrix([cos(B[i,3]),(-sin(B[i,3])*cos(B[i,2])), sin(B[i,3])*sin(B[i,2]), 
    B[i,1]*cos(B[i,3])],[sin(B[i,3]),cos(B[i,3])*cos(B[i,2]),-
    cos(B[i,3])*sin(B[i,2]),B[i,1]*sin(B[i,3])],[0,sin(B[i,2]),cos(B[i,2]),B[i,4]],[0,0,0,1]));

谢谢。

4

2 回答 2

1

只需使用下标变量。

for i:1 thru 3 do A[i] : <complicated stuff>;

构造变量 A1、A2、A3 ... 是可能的,但被认为是错误的形式。

于 2013-09-30T22:23:43.530 回答
0

您可以使用运算符 ::

B:matrix([0,-%pi/2,theta[1],0],[0,%pi/2,0,d[2]],[a[3],0,theta[3],0]);

D:matrix_size(B);

for i: 1 step 1 thru D[1] do
concat('A, i) :: matrix([cos(B[i,3]),(-sin(B[i,3])*cos(B[i,2])), sin(B[i,3])*sin(B[i,2]), 
  B[i,1]*cos(B[i,3])],[sin(B[i,3]),cos(B[i,3])*cos(B[i,2]),-
  cos(B[i,3])*sin(B[i,2]),B[i,1]*sin(B[i,3])],[0,sin(B[i,2]),cos(B[i,2]),B[i,4]],[0,0,0,1]);
于 2013-08-29T08:26:03.440 回答