Azzera filtri
Azzera filtri

Remote matlab running: changing folder and running script

4 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Steven Lord
Steven Lord il 1 Set 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 Commento
AES
AES il 1 Set 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...

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by