Running Matlab remotely

54 visualizzazioni (ultimi 30 giorni)
David
David il 16 Mar 2012
Commentato: horst il 21 Dic 2013
I currently have Matlab installed on a Linux Workstation with the Ubuntu OS. I've updated the .bashrc file so that the Matlab directory is set as a PATH, and that I can type "matlab" from an run the program from the terminal without problem.
However, when I ssh into my Linux Workstation from my MacBook pro and try to run Matlab remotely using Mac's "Terminal" application by typing "matlab", it returns the message "matlab: command not found".
I simply only need to run matlab from the terminal (no need for graphics). Any advice on this? I've tried to messing around with my .bashrc and .bash_profile files on the Linux machine and my Mac to no avail.

Risposte (4)

the cyclist
the cyclist il 16 Mar 2012
I believe that the answer (and particularly the ideas in the comments) here
might help you.

Jason Ross
Jason Ross il 16 Mar 2012
It sounds like the remote workstation isn't set up to source your .bashrc file. As a quick test when you log in, you can do
. /path/to/your/.bashrc
And then see if you can start MATLAB after that. If you can, your system is not sourcing the file automatically. This could be because of a few reasons:
  • The shell being used for login isn't bash -- it could, for example, be tcsh, so the .bashrc won't be sourced.
  • The remote system isn't configured to source your .bashrc. Check in the /etc directory and look at bash.bashrc. You may need to do something to /etc/profile to have it source the file. Each system is a little different, but you can google around for how it works if the comments in the various files don't make sense.

David
David il 16 Mar 2012
Thanks a lot!
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 in from my Mac.
  2 Commenti
Daniel Shub
Daniel Shub il 16 Mar 2012
It sounds like you have a solution. Please accept the best answer to this question and vote for other answers that where helpful in solving your problem.
horst
horst il 21 Dic 2013
have you tried simply entering bash at first when you open your terminal?

Accedi per commentare.


Daniel Shub
Daniel Shub il 16 Mar 2012
While David has a working solution. Three other options are:
Create a symbolic link to the matlab binary in /usr/bin
sudo ln -s /usr/local/MATLAB/R2010b/bin/matlab /usr/bin/matlab
this will allow you to run MATLAB directly from the command line without having to add a path. Some people might link the current version to both /usr/bin/matlab and /usr/bin/matlab_r2011a (or whatever naming convention suits your fancy)
Another option instead of exporting the path is to simply supply the path when launching matlab
/usr/local/MATLAB/R2010b/bin/matlab
You can also add an rc file to your .ssh directory on the remote machine to add the path or source your bash.rc. something like Jason's
. /path/to/your/.bashrc
  3 Commenti
Daniel Shub
Daniel Shub il 16 Mar 2012
Are there distros that do not have /usr/bin on the path by default? Are there users/sys admins who take /usr/bin off the path?
Jason Ross
Jason Ross il 16 Mar 2012
With 4000+ versions of Linux + BSD out there (source: distrowatch.com), anything is possible :)
I would expect both /bin and /usr/bin to be on the path, though. I can't imagine someone taking them off them path, either. I've done that when I've fat-fingered a PATH setting in the past, and it's not pretty ... at all. "ls: not found" ... oops :)

Accedi per commentare.

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by