Hi all...
I need some help in manipulation of the text files to read in a matrix text file. The format of the text file is as follows:
<matrix>
rows = 2
cols = 2
1 2
2 4
</matrix>
I need to read in the text file and put the 1 2 2 4 into a 2D array. I need some help in reading the text file and populate the 2D array.
and this is my code segment:
String file1 = "", file2 = "";
int cols, rows;
double[][] matrix;
file1 = readFile();
try {
BufferedReader brStream = new BufferedReader(new FileReader(file1));
String strLine = "";
while (strLine.equals(brStream.readLine().equals("</martrix>"))) {
if(strLine.contains("rows = ")){
Scanner str = new Scanner(strLine);
str.useDelimiter(" = ");
while(str.hasNextToken)
}
}
is there any suggestion reading in the file? thanks!!