Java PrintWriter Write saveProbabilityData(String file, double[] probabilities, double start, double dt)

Here you can find the source of saveProbabilityData(String file, double[] probabilities, double start, double dt)

Description

save Probability Data

License

Open Source License

Parameter

Parameter Description
file a parameter
probabilities a parameter
d a parameter

Declaration

public static void saveProbabilityData(String file, double[] probabilities, double start, double dt) 

Method Source Code


//package com.java2s;
/*//from  www.  j  av a  2 s. c  o m
 * Michele Loreti, Concurrency and Mobility Group
 * Universit? di Firenze, Italy
 * (C) Copyright 2013.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Michele Loreti
 */

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

public class Main {
    /**
     * @param file
     * @param probabilities
     * @param d 
     */
    public static void saveProbabilityData(String file, double[] probabilities, double start, double dt) {
        try {
            File dataFile = new File(file + File.separator + "output.dat");
            PrintWriter writer = new PrintWriter(dataFile);
            for (int i = 0; i < probabilities.length; i++) {
                writer.println((start + (i * dt)) + "\t" + probabilities[i]);
            }
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. saveLastExpInfo(String fileName, int[] info)
  2. saveLine(File file, String line)
  3. saveList(List list, OutputStream outs)
  4. saveMatrixAsADM(AtomicReferenceArray matrix, String path)
  5. saveMineField(File fileName, String mineField)
  6. saveProcessedDataFile(double[][] data, String file)
  7. saveSet(Set set, File setFile, String encoding)
  8. saveSortedMap(Map map, File mapFile, String separator, String qualifier, String encoding)
  9. saveString(String theFilePath, String theString)