How to run a Matlab Script via Putty?
Show older comments
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)
Walter Roberson
on 19 Dec 2017
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
Shehan
on 20 Dec 2017
Thank you Walter. I added the details to bash_profile as mentioned and t works now.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!