Can I use MATLAB from the Terminal Command Line in OS X?

128 vues (au cours des 30 derniers jours)
Eric
Eric le 22 Sep 2011
Commenté : Ethan Duckworth le 21 Fév 2023
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 commentaire
Brando Miranda
Brando Miranda le 11 Déc 2017
was the matlab command not available for you? It wasn't for me.

Connectez-vous pour commenter.

Réponse acceptée

the cyclist
the cyclist le 22 Sep 2011
I believe you should be able type
matlab -nodesktop
at the command prompt. (I got a license error when I did that, but I think it should work.)
  10 commentaires
Ethan Duckworth
Ethan Duckworth le 5 Fév 2021
This works, sort of. I added
alias matlab="/Applications/MATLAB_R2020b.app/bin/matlab -nodesktop"
to both .bashrc and .bash_profile and ...
(1) Yes, it launched.
(2) It's a little slow to launch, probably because it still launches some sort of graphical app wrapper, i.e. a graphical splash screen, and an icon in the dock, which in turn creates a MATLAB menu bar along the the top, and the terminal includes a whole bunch of complaints about not finding various fonts, about 10 lines like this
2021-02-05 16:22:08.382 MATLAB_maci64[96303:7667690] CoreText note: Client requested name ".SFNS-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
It would be nice to have something that launches faster, with no graphical splash screen, icon, menu bar, and lines of font complaints.

Connectez-vous pour commenter.

Plus de réponses (4)

David
David le 16 Mar 2012
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 commentaires
Brando Miranda
Brando Miranda le 1 Fév 2016
but how did you find the location of the binaries of MATLAB in the first place?
Walter Roberson
Walter Roberson le 1 Fév 2016
The binaries are under fullfile(matlabroot, 'bin')

Connectez-vous pour commenter.


Cheng Yang
Cheng Yang le 1 Fév 2017
I found
matlab -nodisplay
works better for me. -nodesktop still add an icon to the dock
  2 commentaires
Mahmud Sami Özgür
Mahmud Sami Özgür le 1 Mai 2019
Modifié(e) : Mahmud Sami Özgür le 1 Mai 2019
When I launch with
matlab -nodisplay
plot functions do not show anything.
matlab -nodesktop -nosplash
works better.
Ethan Duckworth
Ethan Duckworth le 5 Fév 2021
For me, -nodisplay is the final trick. It suppresses the icon in the dock, and the font loading errors. Thanks!

Connectez-vous pour commenter.


Carter Rhea
Carter Rhea le 11 Juil 2015
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 commentaires
__init__.py
__init__.py le 9 Fév 2019
Modifié(e) : __init__.py le 9 Fév 2019
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
Walter Roberson le 9 Fév 2019
using open would be for graphics use not for terminal use.

Connectez-vous pour commenter.


darryl west
darryl west le 7 Oct 2016
or just a bit better with...
alias matlab='/Applications/MATLAB_R2016b.app/bin/matlab -nodesktop -nosplash $*'
  6 commentaires
Walter Roberson
Walter Roberson le 25 Nov 2019
The Mac installer does not offer to create links.
Walter Roberson
Walter Roberson le 25 Nov 2019
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by