How can I make my numpad act like numbers?

4 views (last 30 days)
Matlab 2014b, linux.
I'm experiencing some strange numpad bindings with this version.
The keys along the top row function properly, but the numpad keys do not. This does happen whether the key mappings are "windows" or "emacs" mode. This does not happen if matlab is run from windows.
1, 2, 3, 5, and 6 function normally 4 deletes the previous character and replaces it with a 4 7 deletes the previous text in that line and replaces it with a 7 8 deletes the previous text in that line, moves up a line, and inserts an 8 9 deletes all of the editor text behind the cursor and replaces it with a 9.
I have no idea what's going on or how to fix it, I just want my numpad to act like numbers. Ideas?
  1 Comment
Steven Theriault
Steven Theriault on 4 Dec 2015
Edited: Steven Theriault on 4 Dec 2015
Have you found a solution for this problem? I have the same issue.
One additional bit of important information: the number pad works everywhere except Matlab, eg termal window, text editors, etc.

Sign in to comment.

Accepted Answer

Jason Bell
Jason Bell on 12 Feb 2016
I stumbled across this question as I was having the same problems (on MATLAB 2013b and 2015b).
I have created a workaround, in which users use “xmodmap” to change the “numpad” values for each of the keys.
I created a script “numkey-fix.sh” which contains the following
> cat numkey-fix.sh
xmodmap -e "keycode 79 = 7"
xmodmap -e "keycode 80 = 8"
xmodmap -e "keycode 81 = 9"
xmodmap -e "keycode 83 = 4"
xmodmap -e "keycode 84 = 5"
xmodmap -e "keycode 85 = 6"
xmodmap -e "keycode 87 = 1"
xmodmap -e "keycode 88 = 2"
xmodmap -e "keycode 89 = 3"
xmodmap -e "keycode 90 = 0"
The issue is that with the newer versions of “X Windows” for Linux, it uses a different values for these keys which matlab doesn’t understand correctly and causes the issues described above.
So I execute this script before starting matlab and the issues should be fixed.
Basically, what is does is changes the default values, which looks something like
xmodmap -e "keycode 79 = KP_7"
xmodmap -e "keycode 80 = KP_8"
xmodmap -e "keycode 81 = KP_9"
xmodmap -e "keycode 83 = KP_4"
xmodmap -e "keycode 84 = KP_5"
xmodmap -e "keycode 85 = KP_6"
xmodmap -e "keycode 87 = KP_1"
xmodmap -e "keycode 88 = KP_2"
xmodmap -e "keycode 89 = KP_3"
xmodmap -e "keycode 90 = KP_0"
Hopefully this might be useful to others.
Cheers, Jason.
  1 Comment
Stan Kruger
Stan Kruger on 12 Feb 2016
Great fix, thanks! Over a year later this had still been irritating me. I should also mention that this issue wasn't specific to MATLAB, my terminal windows were having similar screwed up bindings. This fix has resolved that issue as well.

Sign in to comment.

More Answers (0)

Categories

Find more on Audio Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!