I have a text file including 399000 data all in one column( e.g. in each line I have just one data, so I have 399000 lines), I wnat to read the data into a 3D array of 56*150*35 element?
How to do this in C# ( less favorable in C++ and VB )?
If you need more inf, please let me know
The data in the text file is arranged in this order:
(1,1,35)
(2,1,35)
...
(76,1,35)
(1,2,35)
...
(76,2,32)
...
..
(76,150,35)
(76,150,34)
...
(76,150,0)
AlanPosted Sep 24, 2008, 2:13 PM
If you want the data in string form, you could do:
string[,,] data = new string[76, 150, 35];
StreamReader sr = new StreamReader(filePath);
for(int k = 34; k >= 0; k--)
{
for (int j = 0; j < 150; j++)
{
for (int i =0; i < 76; i++)
{
data[i,j,k] = sr.ReadLine();
}
}
}
sr.Close();
Notice that arrays in C# are always zero-based.