简体   繁体   中英

Storing matrices in an array in visual basic 6

I am new to vb6 programming and i have the following problem.

I am computing some 2x2 matrices inside a for loop and i want to store these matrices in an array. To be more precise i want to know if there is something like the cell array in Matlab. That is (for a 1x2 cell array and 2x2 matrices) i can have

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

where each of A1, A2 are 2x2 matrices. Is there anything like this in 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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