E
elziko
I have a four dimensional array which I am trying to flatten into a single
dimension array:
Dim Array4D(10,10,10,10) as Single
I can create my one dimensional array to be big enough to contain teh data
from the 4D array:
Dim Array2D(Array4D.Length - 1) As Single
Then I populate it like so:
Dim intArray2dIndex As Integer
For t As Integer = 0 To Array4D.GetUpperBound(0)
For x As Integer = 0 To Array4D.GetUpperBound(1)
For y As Integer = 0 To Array4D.GetUpperBound(2)
For z As Integer = 0 To Array4D.GetUpperBound(3)
Array2D(intArray2dIndex) = Array4D(t, x, y, z)
intArray2dIndex += 1
Next
Next
Next
Next
But once I have my 1D array how do I retrieve a value from it using the
original t,x,y,z values? In other words, given a t, x, z and y value that
would describe a position in the 4D array I need to translate that to a
single value that describes the position in the one dimensional array.
Any help on this one?
TIA
dimension array:
Dim Array4D(10,10,10,10) as Single
I can create my one dimensional array to be big enough to contain teh data
from the 4D array:
Dim Array2D(Array4D.Length - 1) As Single
Then I populate it like so:
Dim intArray2dIndex As Integer
For t As Integer = 0 To Array4D.GetUpperBound(0)
For x As Integer = 0 To Array4D.GetUpperBound(1)
For y As Integer = 0 To Array4D.GetUpperBound(2)
For z As Integer = 0 To Array4D.GetUpperBound(3)
Array2D(intArray2dIndex) = Array4D(t, x, y, z)
intArray2dIndex += 1
Next
Next
Next
Next
But once I have my 1D array how do I retrieve a value from it using the
original t,x,y,z values? In other words, given a t, x, z and y value that
would describe a position in the 4D array I need to translate that to a
single value that describes the position in the one dimensional array.
Any help on this one?
TIA