Java PrintWriter Write saveHeatmapTableCsv(PrintWriter wr, double[][] coefficients, String[] labelNames)

Here you can find the source of saveHeatmapTableCsv(PrintWriter wr, double[][] coefficients, String[] labelNames)

Description

Save heatmap table as .csv file

License

Open Source License

Parameter

Parameter Description
wr PrintWriter
coefficients Coefficients
labelNames Label names

Declaration

public static void saveHeatmapTableCsv(PrintWriter wr, double[][] coefficients, String[] labelNames) 

Method Source Code


//package com.java2s;
/*/*  ww w  . j  av  a2 s  .  c  o  m*/
 * This file is part of the MLDA.
 *
 * (c)  Jose Maria Moyano Murillo
 *      Eva Lucrecia Gibaja Galindo
 *      Sebastian Ventura Soto <sventura@uco.es>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

import java.io.PrintWriter;

public class Main {
    /**
     * Save heatmap table as .csv file
     * 
     * @param wr PrintWriter
     * @param coefficients Coefficients
     * @param labelNames Label names
     */
    public static void saveHeatmapTableCsv(PrintWriter wr, double[][] coefficients, String[] labelNames) {
        //Save label names row
        String line = new String();
        line += " ;";

        for (String labelName : labelNames) {
            line += labelName + ";";
        }

        wr.write(line);
        wr.write(System.getProperty("line.separator"));

        for (int i = 0; i < labelNames.length; i++) {
            line = "";
            line += labelNames[i] + ";";

            for (int j = 0; j < coefficients[i].length; j++) {
                if (coefficients[j][i] == -1) {
                    line += "" + ";";
                } else {
                    line += coefficients[j][i] + ";";
                }
            }
            wr.write(line);
            wr.write(System.getProperty("line.separator"));
        }

    }
}

Related

  1. saveChiPhiTableCsv(PrintWriter wr, double[][] coefficients, String[] labelNames)
  2. saveConvert(final String text, final int escapeMode, final PrintWriter writer)
  3. saveFile(File f, String text)
  4. saveFile(String fileName, String data)
  5. saveFile(String path, String text)
  6. saveLastExpInfo(String fileName, int[] info)
  7. saveLine(File file, String line)
  8. saveList(List list, OutputStream outs)
  9. saveMatrixAsADM(AtomicReferenceArray matrix, String path)