Results Table CSV file- tab to comma-delimited?

Posted by Gabriel Landini on
URL: http://imagej.273.s1.nabble.com/Results-Table-CSV-file-tab-to-comma-delimited-tp5018049.html

Hi
We have a plugin that takes a Results table and saves it.
That is a CVS file, which is tab-delimited. We then load that file to weka from
the plugin.

In weka v3.6 this cvs file could be loaded without any problems.  When updating
to 3.8  or 3.9 there is an error:
 
An error occurred: java.io.IOException: wrong number of values. Read 24,
expected 23, read Token[EOL], line 2 Problem encountered on line: 2      

The file is the same one, it can be loaded in one version of weka, but not in
the other.

I am guessing that the weka CVS reader is not behaving or expects a comma
delimited file, not just tab-delimited.

The code we are using to do this is:
ResultsTable rt= ResultsTable.getResultsTable();
int[] assignments = new int[rt.size()];
String IJdir = IJ.getDirectory("imagej");
rt.saveAs(IJdir+"datatobeclustered3.cvs");
CSVLoader loader = new CSVLoader();
loader.setSource(new File(IJdir+"datatobeclustered3.cvs"));

Does anbody have any idea of what might be going on?

Is there any way to save the Results table as comma-delimited instead of tab-
delimited?

Or is there a platform-agnostic way of converting tabs to , ?

Many thanks

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html