- Starts without the desktop
- Exits automatically with exit code 0 if statement executes successfully. Otherwise, MATLAB terminates with a non-zero exit code.
Run matlab script on remote windows computer using cmd
8 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to run several different MATLAB scripts on a remote windows computer to aggregate data from various sensors. How can I start a matlab script from cmd over ssh? I have tried matlab -nodesktop -noFigureWindows -nosplash -r "myscript; exit", but the script never runs.
0 个评论
回答(1 个)
Fangjun Jiang
2025-8-8
I suspect that there is a conflict between the "-nodesktop" optoin and the "-r statement".
Try matlab -nodesktop -noFigureWindows -nosplash -batch "myscript"
From the document
-batch statement
Execute MATLAB script, statement, or function non-interactively. MATLAB:
-r statement
Execute the MATLAB statement. Use this option for interactive workflows. Do not use this option with the -batch option.
4 个评论
Fangjun Jiang
2025-8-22
Need clarification.
1. Connect through a remote desktop APP
Run matlab -nodesktop -batch "myscript". Successful!
2. Connect through SSH
Run matlab -nodesktop -batch "myscript". License error!
What is the error message? What is the pwd() when you run "matlab" (are they different in the above two cases?). How is MATLAB license specified?
Fangjun Jiang
2025-8-25
For license issue, you could specify a license file directly when calling "matlab", e.g.
matlab -c "c:\MathworksLicense\NetworkLicense.lic"
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!