Re: 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-tp5018049p5018053.html

On Tuesday, 7 February 2017 14:12:32 GMT John Hayes wrote:
> According to this you can change the field separate with the
> CSVLoader::setFieldSeparator function.
> http://javadoc.imagej.net/Fiji/weka/core/converters/CSVLoader.html

Dear John and Brandon,
Thanks for your prompt replies. That setOptions method was exactly what I was
looking for... not sure how I missed it. The CSV file was fine, the separator
was \t and it seems that it was  autodetected in 3.6 but not in 3.8 or 3.9.

Just in case it is useful to somebody else, loading the tab-delimited file is
done using the options "-F" and "/t" :
ResultsTable rt= ResultsTable.getResultsTable();
int[] assignments = new int[rt.size()];
String IJdir = IJ.getDirectory("imagej");
rt.saveAs(IJdir+"datatobeclustered3.cvs");
CSVLoader loader = new CSVLoader();
String[] opts = new String[]{"-F", "\t"};
loader.setOptions(opts);
loader.setSource(new File(IJdir+"datatobeclustered3.cvs"));

Many thanks again for your help.

Gabriel

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