Deactivate MEvent.CASE in Java IDEs
I'm using MATLAB R2014a on my laptop running Ubuntu 14.04 LTS, and am experiencing a rather annoying issue. Whenever I use the two-finger scrolling gesture on my touchpad in either the editor or the main window, the following output appears in the command window:
While the scrolling works, this line is output over and over again as I continue to perform the gesture.
Any ideas for how to stop this from happening?
NOTE: It also occurs in Processing and Arduino IDE
As a user I wouldn't want to type the above command everytime I open MATLAB. So I searched a bit on matlab 'startup' command line section, and the 'search path' section. I solved my problem after doing the following simple steps:
- See your userpath by typing userpath in MATLAB console: For linux it is: home/username/Documents/MATLAB/
Create a file 'startup.m' having only one line, which will disable Mevent.CASE! (Below is the text to copy)
!synclient HorizEdgeScroll=0 HorizTwoFingerScroll=0
Place the created startup.m file in your userpath folder as defined in MATLAB.
- Now as soon as you place this file in your userpath, restart MATLAB.
- Verify by seeing ans = 0 in the workspace section.
It worked for me on Ubuntu 15.04 running MATLAB R2015b, I hope it works for you all as well.
Note: This is an improvement to @someDude and @Slothworks answer.
None of these solutions worked for me. Moreover I like to keep the two finger scrolling. This works for me:
MATLAB relies on jdk7, jdk8 will not work with it. It appears 16.04 and later no longer provide openjdk-7-jre in the repos, and it must be installed from external sources. To install it:
sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-get update sudo apt-get install openjdk-7-jdk
Ensure that you have correctly set the MATLAB_JAVA variable. This can be checked with:
If the output is empty, this variable is empty. It can be set with
Then, execute MATLAB from the same shell with whatever command you use to call MATLAB, usually
In the MATLAB command window, run
and verify that the output contains "OpenJDK". If all is successful, you should no longer see the MEvent. CASE! error message.
To make this persistent: add
to the /etc/profile file (for system wide change) or to ~/.profile for local user
Deactivating horizontal scrolling may fix the issue. Try running the following at the gnome-terminal:
synclient HorizEdgeScroll=0 HorizTwoFingerScroll=0
Or the following in the MATLAB console:
!synclient HorizEdgeScroll=0 HorizTwoFingerScroll=0
GNOME 3.20 ::SYNCLIENT IS OBSOLETE, Fixing the MEvent. CASE! error in MATLAB for xinput
The suggested solution is to run
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 Horizonal Scroll Enabled (266): 1
and the command used to disable this property is:
~$ xinput set-prop 13 "libinput Horizonal Scroll Enabled" 0
To have this run automatically every time you run MATLAB you can add
!xinput set-prop 13 "libinput Horizonal Scroll Enabled" 0
to your startup file.
For people who doesn't have simulink but x-input This is an improvement of Riyas Jaleel to only disabled horizontal scroll in matlab but not in others app.
First of all install xdotool that allows to know the current window name
sudo apt install xdotool
Now create a script named patchScroll.sh in the bin folder of matlab with the following content
while [ true ] do window=`xdotool getwindowfocus getwindowname` is_enabled=2 if [ "$window" = "MATLAB R2017a" ]; then if [ "$is_enabled" != "0" ]; then xinput set-prop 13 "libinput Horizonal Scroll Enabled" 0 is_enabled=0 echo "is_enable $is_enabled" fi else if [ "$is_enabled" != "1" ]; then xinput set-prop 13 "libinput Horizonal Scroll Enabled" 1 is_enabled=1 echo "is_enable $is_enabled" fi fi sleep 1 done
now in the matlab file in bin folder that launch matlab add ./patchScroll.sh & between first and current second line
We can't directly put the code in matlab file because the loop is infinite and it will block the launch of matlab, it is why we use & at end.