Search code examples
javafilecsvejml

Issue with loading csv with ejml


I'm encountering some problems by using the MatrixIO.loadcsv() function in ejml. In fact, I need to load a file into a matrix; i'm following this official example:

public static void main( String args[] ) {
DMatrixRMaj A = new DMatrixRMaj(2,3,true,new double[]{1,2,3,4,5,6});

try {
    MatrixIO.saveCSV(A, "matrix_file.csv");
    DMatrixRMaj B = MatrixIO.loadCSV("matrix_file.csv");
    B.print();
} catch (IOException e) {
    throw new RuntimeException(e);
}
}

But when I try my code

DMatrixRMaj B = MatrixIO.loadCSV("sets.csv");
B.print();

I always obtain a FileNotFoundException... but the name of the file is correct and in the same folder of the source code. Where can be the problem?


Solution

  • The solution for me (I'm using Windows 10) is to use absolute path, because it seems not to recognize relative ones on my system, despite of the official examples.