setEvent function in matrix.js added