How to run a Matlab Script via Putty?

I try to SSH to my desktop from the laptop and then try to run a Matlab script on the desktop. I try to use $matlab -nospalsh onodesktop - script_name command but nothing is run in the remote machine. It does not show me an error too. What would be the reason for this?

Answers (1)

matlab -nosplash -nodesktop -r "try; script_name; catch; end; quit"
You might need the -nojvm option as well.
Note: matlab might not happen to be on your shell path, so you might need to give the path to the executable, such as
/Applications/MATLAB_R2017a.app/bin/matlab
Alternately if you are doing this a lot, you might want to put an alias in your ~/.bash_profile such as
alias matlab="/Applications/MATLAB_R2017a.app/bin/matlab -nosplash -nojvm -nodesktop"
after which the ssh sessions could use
matlab -r "try; script_name; catch; end; quit"

1 Comment

Thank you Walter. I added the details to bash_profile as mentioned and t works now.

Sign in to comment.

Categories

Asked:

on 19 Dec 2017

Commented:

on 20 Dec 2017

Community Treasure Hunt

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

Start Hunting!