Remote matlab running: changing folder and running script

2 visualizaciones (últimos 30 días)
AES
AES el 1 de Sept. de 2022
Comentada: AES el 1 de Sept. de 2022
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.

Respuesta aceptada

Steven Lord
Steven Lord el 1 de Sept. de 2022
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 comentario
AES
AES el 1 de Sept. de 2022
@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...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by