Matlab keyboard handler