Borrar filtros
Borrar filtros

Running a matlab code through bash script

113 visualizaciones (últimos 30 días)
YOGENDRA SINGH BHANDARI
YOGENDRA SINGH BHANDARI el 13 de Ag. de 2020
Comentada: Walter Roberson el 14 de Ag. de 2020
I've a matlab code that needs to be run for different set of "independent" inputs. I want to run the matlab code through unix bash script, and then run the script in multiple computers parallelly to get the speed-up.
I am fairly new to this. Does any of you have any idea on how to go about it?
.

Respuesta aceptada

Walter Roberson
Walter Roberson el 13 de Ag. de 2020
You need to find your MATLAB command line executable. For Mac it would be /Applications/MATLAB_R2020a.app/bin/matlab . You would invoke it with -nojvm and -nodesktop . With sufficiently new MATLAB releases you might instead prefer to use -batch
/Applications/MATLAB_R2020a.app/bin/matlab -nojvm -nodesktop %older
/Applications/MATLAB_R2020a.app/bin/matlab -batch
You would then follow that on the command line with a -r option and then the quoted command to execute. It is safest to put the command within try/catch if you are not using the -batch command: For example,
/Applications/MATLAB_R2020a.app/bin/matlab -nojvm -nodesktop -r "try; cd('/Appropriate/Place'); AppriopriateFunction(WithParameters);catch; end; quit"
  4 comentarios
YOGENDRA SINGH BHANDARI
YOGENDRA SINGH BHANDARI el 14 de Ag. de 2020
Editada: YOGENDRA SINGH BHANDARI el 14 de Ag. de 2020
As an extension to your second argument, can I generate the compiled executable using -mcc command? Upon doing mcc -m mycode.m -o mycode, two files(one executable, another .sh file) get generated. Will that work?
Walter Roberson
Walter Roberson el 14 de Ag. de 2020
I do not know if .sh will get generated, but an executable would be generated . The executable would not need license checks.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Cluster Configuration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by