## Monday, December 29, 2014

### Matlab in Terminal: Nodesktop Vs Nojvm

There are two choices to use Matlab in terminal or console (under Unix and Linux-based OS), with option -nodesktop or -nojvm. The following two pictures are the similar of Matlab running in terminal with those different options/arguments.

 Matlab with nodesktop

 Matlab with nojvm

### What's the difference?

So, what's the different?  It looks same from the terminal, but with nojvm we cannot do anything which needs java like figure/plot, animation, help and other but with nodesktop we can still do plot, figure, edit and other. When we command plot or figure , matlab with -nojvm will give the following error,
Error using figure
This functionality is no longer supported under the -nojvm startup option. For
more information, see "Changes to -nojvm Startup Option" in the MATLAB Release
Notes. To view the release note in your system browser, run
web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6',
'-browser').
So, if you want to make computation with no figure, it is better to use matlab with -nojvm, but if you want to make plot just use matlab with -nodesktop. Using matlab with -nojvm will save approximateley 400 MB of RAM. However, using Matlab with -nodesktop does not save any substantial memory.

#### Running code inside Unix shell

While using matlabin Unix-based OS like Ubuntu or Fedora, you can directly pass the m-code to Matlab via terminal as follows,

$matlab -nodesktop -nodisplay -r filename  It is equivalent to GNU Octave as, $ octave -q --eval filename

Let's try!