I have a text data file including a lot of double data set as below:
the dta are separated by 3 spaces.

x x x x x
x x x x x
.
.
.
x x x

I want to read these data line by line and from left to right, and put them in a 3D array of size:76*150*140
for( int k=0;k<139;k++)
{
for(int j=0;j<150;j++)
{
for(int i=0;i<75:i++)
{
....
}
}
}

ok, well you have some loops and so on thats good but the data you've shown in your file is 2d, how do you tell which dimension each part you read is to be placed in?

thanks,
the data are 3D !
it means they are just coming after each other.
I have 1596000 double data that configure an array of 76*150*140. The text file just showing all of the data but in a manner that I can put them in a 3D array. the manner is showing in the loop. first the inner loop is being filled then outward.

So I need to read every data

you can think of the 16 data like this:
I would like to put them in a 3d array with
4*2*2 dimension.

1 2 3 4 5 6 7 8
9 10 11 12 13
14 15 16

so,
for k=0 I have ,
1 2 3 4
5 6 7 8
and for k=1 I have
9 10 11 12
13 14 15 16

for example A[0,0,0]=1
A[1,0,0]=2
A[2,0,0]=3
A[3,0,0]=4
A[0,1,0]=5
A[1,1,0]=6
A[2,1,0]=7
A[3,1,0]=8
A[0,0,1]=9
A[1,0,1]=10
A[2,0,1]=11
A[3,0,1]=12
A[0,1,1]=13
A[1,1,1]=14
A[2,1,1]=15
A[3,1,1]=16

OK, so, what bit exactly are you having issues with?

As I am a new commer to C# ,I donot know how to do this? can u plz help me?

I was using below codes: but it's not working:(data are space deliminated)
the error is Input string is not in correct format

double[,,] dArray = new double[76,150,140];
string line = null;
string[] numbers = null;

StringReader sr = new StringReader(filePath);

for (int k = 0; k < 139; k++)
{
   for(int j = 0; j < 149; j++)
   {
      line = sr.ReadLine();
      numbers = line.Split('');
      for(int i = 0; i < 75; i++)
      {
         dArray[i,j,k] = double.Parse(numbers[i]);
      }
   }
}

sr.Close();

at the begining...just upon the reading of darray[i,j,k]

again, that wasnt the question I asked.

I asked you what the value of numbers is..

This article has been dead for over six months. Start a new discussion instead.