Add change dimension to MatrixWindow

Now the dimension of matrix can be changed while the application is
still running. You do not have to restart all over to change matrix
dimension.