Reading 2 and 3 dimensional arrays from external file. Help please
Hello, I am trying to write a program that calculates the determinant of a 3*3 matrix using the Laplace expansion (if you dont know what this is it doesnt matter, you might still be able to help)
In an external file, say "elements.dat" i have 9 numbers, which are the elements of the matrix
1 2 3
4 5 6
7 8 9
I need to input these into the program, and evaluate the determinant using the laplace expansion - for this, I need to use an external function to calculate the determinant of the "minor" matricies (i.e the 2*2 matricies found by removing the ith row and jth column), by taking a 2 dimensional array as an input.
In particular, i need help in this last part, I have no idea how to get the program to make 2-dimensional arrays from the file "elements.dat"
Thanks! Sorry if this is confusing, im not too confident with programming, but i can try to clarify if needed.
One way would to define a 2 dimensional array viz., x2d.
Read each row from the file into each array element - x[[0:2].
Repeat above steps so entire array x2d has been assigned to.