I am trying to convert a string matrix to a double matrix, but keep on getting this error:
Exception in thread "main" java.lang.NullPointerException
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at wim_data_reader.WIMdataReader.main(WIMdataReader.java:135)
Each row in the matrix is not necessarily the same size as the previous row. Here is my code:
//double matrix to store all the converted string elements
double[][] data = new double[WIMdataMatrix.length][];
//double for loop used to convert string elements to double elements and store them in matrix
for (int i = 0; i < WIMdataMatrix.length; i++) {
//
data[i] = new double[WIMdataMatrix[i].length];
for (int j = 0; j < WIMdataMatrix[i].length; j++) {
data[i][j] = Double.parseDouble(WIMdataMatrix[i][j]);
}
}
Please help!