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?

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 12 月 19 日

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 件のコメント

Shehan
Shehan 2017 年 12 月 20 日
Thank you Walter. I added the details to bash_profile as mentioned and t works now.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

質問済み:

2017 年 12 月 19 日

コメント済み:

2017 年 12 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by