/* To get C matrix 42 mnoth x 73 stations */ #include #include #include //#include #include int main() { int s,yy; double sumv; float wv,v,v0[77]; char ls_fn[80],x1_fn[98],x2_fn[98],x3_fn[98],x0_fn[98]; FILE *x1_ptr,*x2_ptr,*x3_ptr,*ls_ptr,*x0_ptr; sprintf(ls_fn,"../c13c_matrix73stn1stvalue.txt"); if ((ls_ptr=fopen(ls_fn, "w")) == NULL) { printf("\n Unable to open file0, exitting...\n"); exit(0); } sprintf(x0_fn,"../c13c_matrix3066_dlt_case1.txt"); if ((x0_ptr=fopen(x0_fn, "r")) == NULL) { printf("\n Unable to open file1, exitting...\n"); exit(0); } for (s=1;s<=73;s++) for (yy=1;yy<=42;yy++) { fscanf(x0_ptr,"%f\n",&v); if (yy==1) v0[s]=v; } for (s=1;s<=73;s++) { sumv=v0[s]+sumv; wv=v0[s]; fprintf(ls_ptr,"stn%d %f\n",s,wv); } fprintf(ls_ptr,"avg for 73 stn: %f\n",sumv/73); fprintf(ls_ptr,"last number for respose f: %f\n",sumv/73/368.955); fclose(x0_ptr); fclose(ls_ptr); printf("done \n"); return 1; }