Now uses matlab_matrix to write the matrices
Various bug fixes
New global generation method