如何让我的矩阵数组变成这样?
我有一个像这样的矩阵:
A = 1 2 3
4 5 6
7 8 9
我的问题是如何使我的矩阵像这样:
A11 = 1
A12 = 2
A13 = 3
A21 = 4
A22 = 5
A23 = 6
A31 = 7
A32 = 8
A33 = 9
因为我必须将 A21 与 A22 相乘,即 4x5=20。
I have a matrix like this:
A = 1 2 3
4 5 6
7 8 9
My question is how I want to make my matrix to be like this:
A11 = 1
A12 = 2
A13 = 3
A21 = 4
A22 = 5
A23 = 6
A31 = 7
A32 = 8
A33 = 9
Because i have to multiply A21 with A22 which is 4x5=20.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的问题我不清楚。
要创建矩阵,请使用“,”(或不使用任何内容)来分隔列,“;”来分隔行。
要访问矩阵,您可以使用一维索引和二维索引。
例如,A21 是
A(2, 1)
以及A(0*3+2)
。Your question is not clear to me.
To create the matrix, use ',' (or nothing) to delimit columns, ';' to delimit rows.
To access the matrix, you can use a 1-dimensional index as well as a 2-dimensional index.
E.g. A21 is
A(2, 1)
as well asA(0*3+2)
.如果您实际上需要“A11”、“A12”等变量,您可以执行以下操作:
也许不是最好的方法,但它会为您创建变量。
If you actually need variables such as 'A11', 'A12' etc. you could do as follows:
Maybe not the best way, but it will create the variables for you.