public void toCSV ( String fileName ) throws Exception { BufferedWriter out = new BufferedWriter ( new FileWriter ( new File ( fileName ) ) ) ; for ( int i = 0 ; i < loadCounter ; i ++ ) { String identifier = getId ( i ) ; double [ ] vector = getVector ( i ) ; out . write ( identifier ) ; for ( int k = 0 ; k < vector . length ; k ++ ) { out . write ( "," + vector [ k ] ) ; } out . write ( "\n" ) ; out . flush ( ) ; } out . close ( ) ; }
Writes all vectors in a csv formated file . The id goes first followed by the vector .