T
Tom
I have a datafile which has a form of
10.10 10.20 10.30 ...
20.10 20.20 20.30 ...
30.10 30.20 30.30 ...
.. . .
.. . .
.. . .
it has 500 rows and 10002 colums.
I tried to read the whole data in a single variable.
My pc shows error. (Windows XP, notebook)
All I need is to read each column data and do some integration.
and so on for every colum.
my naive code is following but, it is too slow.
(it is also limited to read first column, but have to expand to read
every column)
---------------------------------------------------------------------------------------------
FILE *fp;
float b;
int i,j;
float a[500];
fp = fopen("2Dwedge_V1_Ga2.36_st6.28_K1.06_B4.00_e0.20posi.dat","r");
for(i=0;i<=499;i++)
{
fscanf(fp,"%f",&(a));
for(j=1;j<=10002;j++)
{
fscanf(fp,"%f",&b);
}
Dosomethingwith(float a, 500);
}
---------------------------------------------------------------------------------------------
10.10 10.20 10.30 ...
20.10 20.20 20.30 ...
30.10 30.20 30.30 ...
.. . .
.. . .
.. . .
it has 500 rows and 10002 colums.
I tried to read the whole data in a single variable.
My pc shows error. (Windows XP, notebook)
All I need is to read each column data and do some integration.
and so on for every colum.
my naive code is following but, it is too slow.
(it is also limited to read first column, but have to expand to read
every column)
---------------------------------------------------------------------------------------------
FILE *fp;
float b;
int i,j;
float a[500];
fp = fopen("2Dwedge_V1_Ga2.36_st6.28_K1.06_B4.00_e0.20posi.dat","r");
for(i=0;i<=499;i++)
{
fscanf(fp,"%f",&(a));
for(j=1;j<=10002;j++)
{
fscanf(fp,"%f",&b);
}
Dosomethingwith(float a, 500);
}
---------------------------------------------------------------------------------------------