Remote matlab running: changing folder and running script

조회 수: 3 (최근 30일)
AES
AES 2022년 9월 1일
댓글: AES 2022년 9월 1일
I was wondering how to change a matlab directory while using ssh in puTTY for a remote session that does not end when I close the ssh terminal.
So far I have:
nohup matlab -nodesktop -nodisplay < sshTest.m &
I have also tried:
nohup matlab -nodesktop -nodisplay < cd(DIRECTORY) sshTest.m &
But I get the following error:
-bash: syntax error near unexpected token `('
My matlab directory is different than the initial directory when I ssh. I am comfortable completing this in several lines, however I am unsure how to include 'nohup' for continued running of the script even if I lose connection to the server within the several line method.
This is how I did it in multiple lines:
matlab -nodesktop -nodisplay
cd(DIRECTORY)
sshTest
Any help is appreciated. Thank you.

채택된 답변

Steven Lord
Steven Lord 2022년 9월 1일
Instead of piping the contents of the file to MATLAB, use the -batch or -r startup options in conjunction with the -sd startup option.
  댓글 수: 1
AES
AES 2022년 9월 1일
@Steven Lord Do you have resources for using the -sd in the startup file?
I have been trying this:
-sd 'DIRECTORY'
But I get this error and the start directory is not changed:
Warning: Executing startup failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup, which should
be resolved as soon as possible. Error detected was:
MATLAB:m_missing_variable_or_function
Error: File: /(startup location)/startup.m Line: 30 Column: 5
Invalid use of operator.
It said the error was in the line that I included the above -sd...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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