MATLAB: External editor on Ubuntu 16.10

editeditorlinuxMATLABUbuntu

I'm currently switching to linux from windows, and I'd like to use matlab in -nodesktop mode. I configured gedit to open .m files with Matlab syntax highlighting, and that is ok. But I'm not able to start gedit (or any other external editor) via the "edit" command.
How should I configure the external editor in Matlab preferences? I tried selecting "Text Editor" and setting it to /usr/bin/gedit (or /usr/bin/emacs), but It's not working.
I'm running Matlab r2016b under Ubuntu 16.10
Thanks!

Best Answer

I am assuming that you would like to change the Editor/Debugger under preferences in MATLAB, so when you edit any file, it will be open in that editor. But on Linux machine, when you are setting this to gedit or any other editor, its not working.
The possible reason for this is that your LD_LIBRARY_PATH has the path to some other C/C++ shared libraries that wouldn't allow this.
As a workaround, you can set the external editor in LD_LIBRARY_PATH:
LD_LIBRARY_PATH = ; /usr/bin/gedit