Remote matlab running: changing folder and running script

3 vues (au cours des 30 derniers jours)
AES
AES le 1 Sep 2022
Commenté : AES le 1 Sep 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.

Réponse acceptée

Steven Lord
Steven Lord le 1 Sep 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 commentaire
AES
AES le 1 Sep 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...

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by