如何将java文件从Eclipse读入Mathematica

如何将java文件从Eclipse读入Mathematica,java,arrays,eclipse,wolfram-mathematica,Java,Arrays,Eclipse,Wolfram Mathematica,所以我正试图为一个类做一个项目,对随机游动和应用程序进行建模。我正在用JavaEclipse进行大部分编程,但我想用Mathematica进行绘图。 我正在Eclipse中使用for循环创建数组。然后我通过 try { PrintWriter outputStream = new PrintWriter(fileName1); for(int j = 0; j<M; j++) { outputStream.println(de

所以我正试图为一个类做一个项目,对随机游动和应用程序进行建模。我正在用JavaEclipse进行大部分编程,但我想用Mathematica进行绘图。 我正在Eclipse中使用for循环创建数组。然后我通过

    try {
        PrintWriter outputStream = new PrintWriter(fileName1);
        for(int j = 0; j<M; j++) {
            outputStream.println(deltaX[j]);
        }
        outputStream.close(); //can't write to this anymore, but flushes data do file
        System.out.println("Done");

    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
试试看{
PrintWriter outputStream=新的PrintWriter(文件名1);

对于(int j=0;j这是因为您创建的文件每行有一个数字。如果您在数字之间留出一个空格,您将得到一个正常的列表。无论如何,在不更改Java代码的情况下,您可以简单地使用

randWalkDist = Flatten[Import["randomWalkDistribution.txt", "Data"]];
把内部的清单弄平。在这之后,一切都会好起来