Hi guys! I need help here, When ever I write onto my text file, i get null and then the value.Please help me! I don't want the "null"!
Here is how it looks like in Notepad++:
null1: 0.22056311934213296
2: 3.017771771149946
null3: 1.508399104807777
4: 0.07575171145562612
null5: 5.187081012091999
6: 2.049001095182013
null
null
null
Here are my codes:
count =0;
for(int a=0; a<countlength2; a++){
for(int b=0; b<countlength1; b++){
R2=0.0;
R2 =(Math.pow((coordinatesRotZ[a][0]-coordinates1[b][0]),2)
+Math.pow((coordinatesRotZ[a][1]-coordinates1[b][1]),2)
+Math.pow((coordinatesRotZ[a][2]-coordinates1[b][2]),2));
R1 += R2; //Store R1 for every loop into R2
count++;
st[a] += Integer.toString(count)+": "+Double.toString(R2)+"\n"; //Change to String so as to store in .txt
st_results[a] += Integer.toString(count)+": "+Double.toString(coordinatesRotZ[a][0])+"\t"+Double.toString(coordinatesRotZ[a][1])+"\t"+Double.toString(coordinatesRotZ[a][2])+"\t"+Double.toString(coordinates1[b][0])+"\t"+Double.toString(coordinates1[b][1])+"\t"+Double.toString(coordinates1[b][2])+"\t"+Double.toString(R2)+"\n";
System.out.println("Count: "+count);
System.out.println("Query:"+coordinatesRotZ[a][0]+"\t"+coordinatesRotZ[a][1]+"\t"+coordinatesRotZ[a][2]);
System.out.println("Target:"+coordinates1[b][0]+"\t"+coordinates1[b][1]+"\t"+coordinates1[b][2]);
System.out.println("RMSD:" +R2);
//System.out.println("");
}
}
RMSD_Final =Math.sqrt(R1/count); //Sum of R1/numofcoordinates
System.out.println("Final RMSD="+fmt.format(RMSD_Final));
//-----------------------Appending to File--------------------------------------
FileUtil util = new FileUtil();
util.writeLinesToFile("RMSDextractedCoordinates.txt", st, count, false);
util.writeLinesToFile("RMSDresults.txt", st_results, count, false);