Run matlab script on remote windows computer using cmd

조회 수: 8 (최근 30일)
Randall
Randall 2025년 8월 7일
댓글: Fangjun Jiang 2025년 8월 25일
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.

답변 (1개)

Fangjun Jiang
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:
  • Starts without the desktop
  • Exits automatically with exit code 0 if statement executes successfully. Otherwise, MATLAB terminates with a non-zero exit code.
-r statement
Execute the MATLAB statement. Use this option for interactive workflows. Do not use this option with the -batch option.
  댓글 수: 4
Fangjun Jiang
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
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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by