Why do I get "-nodesktop: command not found" error

5 次查看(过去 30 天)
Hello,
I'm trying to run Matlab in a headless form from a Linux command line:
matlab -nodesktop -r myscript.m,quit
I get "-nodesktop: command not found" error. My Matlab version is R2013a. Is it something in my environment that needs to be set up?
Thank you.

回答(2 个)

Walter Roberson
Walter Roberson 2018-8-9
You are not invoking MATLAB directly from its real binary: you are invoking a script that is setting up environment variables and then running MATLAB. But that script might be interfering with the parsing of the command line.
At the command line, you can investigate by starting with
which matlab
alias matlab
  2 个评论
Olga Dimov
Olga Dimov 2018-8-11
It's probably that. I was able to find "matlab" file by using "which" command, but the file doesn't have any extension and I don't have permissions to open it to examine it. But assuming it's a script and not the real binary, how can I get the binary file (executable)? I was told I need to compile Matlab in order to run it in a headless form. Are there any instructions on how to compile Matlab? Thank you.
Walter Roberson
Walter Roberson 2018-8-11
编辑:Walter Roberson 2018-8-11
If you
ls -l $(which matlab)
then do the permissions show up with "other" having r-x or just --x ? If it is r-x then you can read the contents, such as with
file $(which matlab)
If the permissions are --x then it is probably an executable.
"I was told I need to compile Matlab in order to run it in a headless form."
MATLAB can be run headless by passing in -nodesktop or -nodesktop -nojvm, but those do require that MATLAB be installed (and licensed) on the machine. Compiling would be used to produce an executable that could run on a machine that had no MATLAB license.
Also, I suspect the Linux versions can still run under X, such as with ssh -X or ssh -Y into the remote machine.

请先登录,再进行评论。


Jan
Jan 2018-8-8
I assume, Matlab cannot find "myscript.m". Are you sure it is in the path? Try
matlab -nodesktop -r "beep,quit"
  1 个评论
Olga Dimov
Olga Dimov 2018-8-11
No it's not that. The file "myscript.m" is right in the directory that I'm running Matlab from.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by