-5
public void fitModel(String opFileName) {
    double alpha = 0.477;
    double[][] data = new double[time.length][order];
    for (int row = 0; row < time.length; row++) {
        for (int col = 0; col < order; col++) {
            data[row][col] = Math.tanh(alpha * (col + 1) * time[row]);
        }
    }
    computeCoeff(data);
    doPrediction(data, opFileName, true);

    }

    System.out.println();
    System.out.println("Model Parameters :");
    for (int i = 0; i < coeff.length; i++) {
        System.out.println(coeff[i]);
    }

    System.out.println();
    System.out.println("% deviation : " + deviation
            / (prediction.length - zeroRecCnt));
}

}

命令提示符显示输入、输出、预测三列。我需要读取这三个列,并将数据写入文本文件。你能帮我解决这个问题吗?

4

1 回答 1

0

扫描仪可能是一个不错的选择:

Scanner scanner = new Scanner(new InputStreamReader(System.in));
System.out.println("Reading input from console using Scanner in Java ");
System.out.println("Please enter your input: ");
String input = scanner.nextLine();
System.out.println("User Input from console: " + input);
System.out.println("Reading int from console in Java: ");
int number = scanner.nextInt();
System.out.println("Integer input: " + number);
于 2013-05-23T07:52:54.587 回答