Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 2.45 KB

DEBUGGING.org

File metadata and controls

68 lines (47 loc) · 2.45 KB

Running bare Emacs with matlab-mode

To isolate problems, it’s often good to run stock Emacs with matlab-mode:

# In /path/to/Emacs-MATLAB-mode
make clean
make lisp    # Build only. If you want to build and run tests remove the lisp target

# From anywhere
echo "% empty" > startup.m
M=/path/to/Emacs-MATLAB-mode
env MATLABPATH=  emacs -Q -L $M -l $M/matlab-autoload.el

# If you want to run a specific version of MATLAB, /matlab-install/bin/matlab:
env MATLABPATH=  PATH=/matlab-install/bin:$PATH  emacs -Q -L $M -l $M/matlab-autoload.el

# If you want to exercise org mode matlab code block evaluation
env MATLABPATH=  PATH=/matlab-install/bin:$PATH  emacs -Q -L $M -l $M/matlab-autoload.el "--eval=(customize-set-variable 'org-babel-load-languages '((matlab . t)))"

Notice that we are creating an empty startup.m and removing the MATLABPATH environment variable. This ensures you are running MATLAB with an unaltered environment. Problems with the matlab-shell can occur when either MATLABPATH or startup.m is altering the behavior of MATLAB. Therefore, if you see problems, try running with an unaltered environment.

If you open *.m you will be using the matlab-mode from /path/to/Emacs-MATLAB-mode.

To run MATLAB in Emacs:

If 'matlab' command is not on your path,
   M-x RET customize-variable RET matlab-shell-command RET
and set it to /path/to/bin/matlab, then set for current session

Next run matlab-shell which runs MATLAB within and Emacs buffer:

  M-x matlab-shell

At the MATLAB prompt run some action, for example
  >> help ls

If you see problems with matlab-shell, it could be that you have MATLAB startup options or other environment issues which are adversely impacting matlab-shell. You can try customizing matlab-shell-command-switches, for example below we add -nosplash and -noFigureWindows which reduces the resource requires on MATLAB:

M-x RET customize-variable RET matlab-shell-command RET

and set for the current session to:

'("-nodesktop" "-nosplash" "-noFigureWindows")

then M-x matlab-shell.

See MATLAB Startup and Shutdown for other options.