I want to open Matlab without the GUI, so pretty much just running it from the Linux terminal. For some reason adding the -nodesktop and -nosplash flags aren't working. Maybe there must be some sort of default settings, that are overwriting these flags? Is there any way to check this? Maybe I'm missing an extra flag?
$ matlab -nodesktop -nosplash
Other Details: Matlab 2012b, ran on Ubuntu 12.04.
Running:
$ matlab -nodesktop -nosplash -nojvm -nodisplay
doesn't work either.
You could try this as a workaround, it worked for me in a simple test (though I'm not running Ubuntu 12.04, so YMMV):
Before you call matlab, set the DISPLAY variable to a non-valid value. For instance:
export DISPLAY=:10.0
matlab
For me, this produces a terminal MATLAB session without a display or splash, even without the command-line options.
Although you seem to have found a workaround, you may have luck with the following command line options:
matlab -noawt -noFigureWindows ...
Related
To run MATLAB on Linux in the command line I use the following:
matlab -nodisplay
But I guess this does not allow windows of plots to open either, because the following command has no output:
plot(X,Y)
How to allow only graphs and plots to display when running MATLAB from the command line?
Under Linux, to run MATLAB in a terminal window use the -nodesktop option. It causes MATLAB to start without the GUI, with all text input and output to happen through the terminal window. But it does not disable the JVM software altogether and so allows interactive figure windows to be displayed.
The -nojvm option disables the JVM software, disallowing all Java-based components of MATLAB, including figure windows. The -nodisplay option disables al graphical display output, but doesn't disable the JVM.
For more details, see the documentation.
I want to set Matlab's userpath etc the following in Terminal, instead of doing it in GUI Matlab session.
userpath('/home/masi/Documents/bin/matlab/')
This thread is continua 2 of the thread How do I specify the MATLAB editor keybindings programmatically
about startup.m where I can set some other things.
I cannot find about it in Documentation so it must be in the undocumented part of Matlab because I know this feature can be done.
My proposal after Suever's answer
Run just once after the installation
echo "export MATLAB_USE_USERWORK=1" >> $HOME/.bashrc
matlab -nodesktop -nosplash -r \
"userpath('/home/masi/Documents/bin/matlab/'); exit;"
Problem with userpath and addpath
See test codes here. Some other configurations have to be applied too.
Matlab: 2016a
System: Linux Ubuntu 16.04
On Linux, the startup.m file should be located within the folder in which you were when you launched MATLAB from the command line.
On Linux® platforms, the default startup folder is the folder from which you started MATLAB.
If you want to use userpath as the startup folder instead of the current directory, you can specify that you'd like to use the userpath via the environment variable MATLAB_USE_USERWORK=1. This will by default point it at $HOME/Documents/MATLAB (or an alternate location if that was set within MATLAB).
To specify the userpath as the startup folder, set the value of the environment variable MATLAB_USE_USERWORK to 1 before startup. By default, userpath is userhome/Documents/MATLAB, and MATLAB automatically adds the userpath folder to the top of the search path upon startup. To specify a different folder for userpath, and for other options, use the MATLAB userpath function.
More info in the documentation
As a side note, if you need to run a MATLAB command from the terminal, it is possible to run MATLAB without the UI and have it execute the necessary command.
matlab -nodesktop -nosplash -r 'commands_here; exit;'
I have a bash script and I want to execute it from Matlab 2014b in Ubuntu 14.04. When I launch it from terminal (that I start from os) everything is ok. I try to launch it from Matlab like this
!./script.sh
It executes but cannot open image files that have to be loaded.
More than that if I launch terminal window from Matlab
!./gnome-terminal
and use it to launch the script I got the same 'file not found' problem. Text files are accessed with no problem. Path to the images are global. To load images opencv library is used. My guess is that for some reason opencv works different from Matlab, but I don't know what to do.
I spend a lot of time to figure out the problem, but still cannot resolve it. I will appreciate any advise or help.
LD_LIBRARY_PATH of Matlab shell differs from one of teminal shell. Following command in Matlab:
setenv('LD_LIBRARY_PATH', <content of LD_LIBRARY_PATH from terminal>)
solves the problem.
Content of LD_LIBRARY_PATH from terminal is printed by
echo $LD_LIBRARY_PATH
I'm using MATLAB R2012b on a win7 computer.
When I launch MATLAB from cmd using matlab -nodesktop, the tab is disabled for auto-completion in command line window. So I have to type the full name of a file, a path or a function.
When I open GUI and set as this link says, (http://www.mathworks.com/company/newsletters/articles/avoiding-repetitive-typing-with-tab-completion.html) auto-completion works fine in GUI. But it doesn't work when -nodesktop option is used.
I used to use R2014b on a Ubuntu machine with -nodesktop option, the auto-completion function works fine.
Is there any way to enable auto-completion in cmd when -nodesktop is chosen.
This question already has answers here:
How do I hide "MATLAB Command Window" when I run an m-file from command line?
(4 answers)
Closed 7 years ago.
Is there a way to run matlab code from command line or linux shell? If yes, please also let me know what OS you are using. I searched online and found several 'answer' but does not work under my desktop (win 7).
I tried following code in cmd matlab -nodesktop -nosplash -nodisplay -nojvm -r "a=[3,4,5,6,6]; dlmwrite('test', a);". Although the code worked and write out the file under current folder, but there is this white backgrounded window open up. Can it just run quietly and when finished, do not show this window?
Yes, you can call matlab from command prompt. In a windows machine it will look like this depending on your matlab installation path:
"C:\Path\to\matlab\matlab.exe" -r matfile.m
But it does open up Matlab gui. I do not know how to run it silently, but including
exit
at the end of your routine will close it automatically.