Can I use MATLAB from the Terminal Command Line in OS X?
古いコメントを表示
I recently installed MATLAB R2010b on a Mac running OS 10.7. I'd like to be able to run it from the command line, ala a Linux system, as I'm not terribly thrilled with the Matlab UI, and I end up SSHing into my computer a fair amount and prefer to stick with the terminal for the most part.
There weren't any instructions for doing so in the Install Guide. Is there a way to set this up? Thanks in advance.
1 件のコメント
Brando Miranda
2017 年 12 月 11 日
was the matlab command not available for you? It wasn't for me.
採用された回答
その他の回答 (4 件)
David
2012 年 3 月 16 日
1 投票
Thanks all!
I also just tried updating the path at the terminal before running matlab with:
export PATH=$PATH:/usr/local/MATLAB/R2010b/bin/
Then I typed "matlab" from the terminal and it worked fine. Must something odd going on with my .bashrc or .bash_profile not updating PATH when I ssh into my Linux workstation.
2 件のコメント
Brando Miranda
2016 年 2 月 1 日
but how did you find the location of the binaries of MATLAB in the first place?
Walter Roberson
2016 年 2 月 1 日
The binaries are under fullfile(matlabroot, 'bin')
Cheng Yang
2017 年 2 月 1 日
I found
matlab -nodisplay
works better for me. -nodesktop still add an icon to the dock
2 件のコメント
Mahmud Sami Özgür
2019 年 5 月 1 日
編集済み: Mahmud Sami Özgür
2019 年 5 月 1 日
When I launch with
matlab -nodisplay
plot functions do not show anything.
matlab -nodesktop -nosplash
works better.
Ethan Duckworth
2021 年 2 月 5 日
For me, -nodisplay is the final trick. It suppresses the icon in the dock, and the font loading errors. Thanks!
Carter Rhea
2015 年 7 月 11 日
0 投票
If you have a .cshrc file, then you can just type alias matlab '/Applications/MATLAB_R2015a.app/bin/matlab -nodesktop'
granted you are using MATLAB_R2015a. Though if you are using a different version just change that. Also make sure you are using the -csh shell which you can check with echo $SHELL. it can be changed by typing: -chsh -s /bin/csh
I hope this helps!
6 件のコメント
Brando Miranda
2016 年 2 月 1 日
Why do I need to use -csh shell? whats wrong with bash?
Brando Miranda
2016 年 2 月 1 日
Is it necessary to have know where the bin location is? That seems weird to me, shouldn't do this automatically after installing?
Walter Roberson
2016 年 2 月 1 日
Bash is fine, some people just prefer csh. Bash uses a couple of different initialization files, with the most relevant one probably being ~/.bashrc . The syntax for aliases is different for bash,
alias matlab='/Applications/MATLAB_R2015a.app/bin/matlab -nodesktop'
OS-X is usually used as a desktop, so MATLAB on OS-X is usually used by clicking on an icon. (You have to install an additional software product to best use OS-X as a server.) With the /Applications structure, it is not typical for add-on packages that have graphics interfaces to write anything into the directories that are on the PATH by default -- not part of the expected "look and feel" of administering OS-X.
Brando Miranda
2017 年 12 月 11 日
you might need fullfile(matlabroot, 'bin') to find where the bin is...just copying ur answer doesn't work (of course).
__init__.py
2019 年 2 月 9 日
編集済み: __init__.py
2019 年 2 月 9 日
I simply type (either bash or cshell)
open <filename>.m
to launch MALTAB if I'd like to run a script at the same time.
The "open" command of Macintosh is equivalent to the effect that you double-click to open a file in Finder - it will launch whatsoever the associated application of the file.
Walter Roberson
2019 年 2 月 9 日
using open would be for graphics use not for terminal use.
darryl west
2016 年 10 月 7 日
or just a bit better with...
alias matlab='/Applications/MATLAB_R2016b.app/bin/matlab -nodesktop -nosplash $*'
6 件のコメント
Walter Roberson
2016 年 10 月 7 日
I am not sure why you say that would be better? "alias" acts like a substitution at the beginning of a command, so if you were to use the alias I showed without the $* part and were to type
matlab this that the other
the effect would be the same as
/Applications/MATLAB_R2015a.app/bin/matlab -nodesktop this that the other
Specifying $* would be something you would do if you were creating a shell function or shell script, but aliases expand in-line and so do not need $* expansion to bring in anything else typed at the end of the line.
Brando Miranda
2017 年 12 月 11 日
編集済み: Walter Roberson
2019 年 11 月 25 日
this is really annoying, why isn't it "just there"?
Brando Miranda
2017 年 12 月 11 日
you might also need fullfile(matlabroot, 'bin')
Steven Lord
2017 年 12 月 11 日
Brando Miranda, on Linux you can create symbolic links during the installation process. See step 8 on this page from the installation documentation. I don't remember off the top of my head if this option is available in the Mac installer, but I suspect it is (or there is a similar option.)
Walter Roberson
2019 年 11 月 25 日
The Mac installer does not offer to create links.
Walter Roberson
2019 年 11 月 25 日
why isn't it "just there"?
Apple discourages apps from modifying system-level initialization files.
Apple is now even dealing with potential issues with kernel drivers by forcing applications to provide their own versions of kernel extensions that live in user space, rather than being shared by several programs in some mid-level authorization space, and the user-level extensions have to be signed by developer certificate.
This turns out to be one of the reasons why the NVIDIA graphics drivers are not being approved by Apple: Apple is forcing the graphics drivers to be per application and signed by the developers -- who, obviously, do not have the interaction with NVIDIA to do that kind of bundling.
Apple is being hard on companies that compete with it; and these days, with it pushing into its own CPUs (not Intel compatible), its own graphics cards and its own GPUs (both custom silicon and not compatible with AMD or NVIDIA), NVIDIA is considered a competitor.
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!