简体   繁体   English

在Visual Basic 6中将矩阵存储在数组中

[英]Storing matrices in an array in visual basic 6

I am new to vb6 programming and i have the following problem. 我是vb6编程的新手,但我遇到以下问题。

I am computing some 2x2 matrices inside a for loop and i want to store these matrices in an array. 我正在for循环内计算一些2x2矩阵,我想将这些矩阵存储在数组中。 To be more precise i want to know if there is something like the cell array in Matlab. 更确切地说,我想知道是否在Matlab中有像单元格这样的东西。 That is (for a 1x2 cell array and 2x2 matrices) i can have 也就是说(对于1x2单元阵列和2x2矩阵),我可以拥有

cell_example{1} = A1
cell_example{2} = A2

where each of A1, A2 are 2x2 matrices. 其中A1,A2均为2x2矩阵。 Is there anything like this in vb6? vb6中有类似的东西吗? Thank you in advance 先感谢您

Dim m As Variant
ReDim m(1 To 2)

Dim ar1() As Long, ar2() As Long
ReDim ar1(1 To 2, 1 To 2)
ReDim ar2(1 To 2, 1 To 2)

m(1) = ar1
m(2) = ar2

'Accessing
m(1)(1,2) = 42

Note that this copies ar1 and ar2 into m , not puts them by reference. 请注意,这会将ar1ar2复制到m ,而不是通过引用将它们放入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM