This rather annoying issue in MATLAB causes the string MEvent. CASE! to be repeatedly printed to the command window every time you scroll any window in the application. The suggested solution is to run

!synclient HorizTwoFingerScroll=0

as part of your startup file to disable horizontal scrolling. This however does not work on more recent linux versions because the synaptics touchpad driver is being deprecated in favour of libinput. The new solution to this problem is slightly more complex however.

First we need to find the id of the touchpad device with the xinput list command from a terminal (not the MATLAB command window). You should see something like:

~$ xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]    Virtual core XTEST pointer                id=4    [slave  pointer  (2)]    SynPS/2 Synaptics TouchPad                id=13   [slave  pointer  (2)]    ELAN Touchscreen                          id=11   [slave  pointer  (2)]

We are interested in the SynPS/2 Synaptics TouchPad which in this case has id=13. We can see the configuration options supported by this device by running :

~$ xinput list-props 13

Remember to change 13 to the id of the touchpad on your machine ! In the output you should see a line like:

Synaptics Two-Finger Scrolling (283):   1, 1

This tells you that two finger scrolling is enabled in the vertical and horizontal directions. To change this run :

~$ xinput set-prop 13 "Synaptics Two-Finger Scrolling" 1 0

If you couldn't find the "Two-Finger Scrolling" line all is not lost. Look for a line related to horizontal scrolling. In my case that was:

libinput Horizontal Scroll Enabled (266):    1

and the command used to disable this property is:

~$ xinput set-prop 13 "libinput Horizontal Scroll Enabled" 0

To have this run automatically every time you run MATLAB you can add

!xinput set-prop 13 "libinput Horizontal Scroll Enabled" 0

to your startup file.