I would like to use a "match with" function to compare two matrix. I think I don t understand something about this function. Let s take a trivial example. Consider 2 simple matrix:
let a = matrix [[1.0; 1155.0; 1.0]
[1.0; 1156.0; 1.0]
[2.0; 1157.0; 1.0]
[3.0; 1157.0; 1.0]]
let b = matrix [[1.; 0.; 1.0]
[1.0; 0.; 1.0]
[2.0; 0.; 1.0]
[3.0; 0.; 1.0]]
Now I would like to copy the second column of matrix "a" in matrix "b". But with the following code, I have the error which say "error FS0010: unexpected symbole [ in the expression. use ( , () ..."*. Here is the code :
for i = 0 to a.NumCols -1 do
match b.[i,0] with
| a.[i,0] -> (b.[i,1]<-a.[i,1])
| _ -> (b.[i,1]<-a.[i,1])
The problem seems to come from a.[i,0] which is not recognized or unexpected. I don t understand why as I just ask to match a float (b.[i,0]) with another float (a.[i,0]). Can you give me an explanation?