Filter löschen
Filter löschen

How do you run Matlab in batch mode in R2021b Update 2?

13 Ansichten (letzte 30 Tage)
Jean-Luc Renard
Jean-Luc Renard am 15 Feb. 2022
Beantwortet: Dinesh am 29 Dez. 2023
Hi,
I would like to run a bash script in matlab without GUI.
In version R2020b, it was working, now (R2021b Update 2) it is not.
xy@host:~/dev/$ matlab -batch "compile_lib.sh"
MATLAB is selecting SOFTWARE OPENGL rendering.
< M A T L A B (R) >
Copyright 1984-2021 The MathWorks, Inc.
R2021b Update 2 (9.11.0.1837725) 64-bit (glnxa64)
December 14, 2021
To get started, type doc.
For product information, visit www.mathworks.com.
>> exit
Also tried: matlab -nodisplay -nosplash -nodesktop -r "run('compile_lib.sh');exit;"
But the output is the same as above.
Could you tell me what is the correct method to do this?
  1 Kommentar
Jan
Jan am 15 Feb. 2022
The run() command required the name of a Matlab script. "compile_lib.sh" does not sound like a Matlab script file name.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Dinesh
Dinesh am 29 Dez. 2023
Hi Jean,
To run a bash script, you don't need MATLAB. You can just open terminal and execute the following command:
bash compile_lib.sh
If the script is a MATLAB script (.m file), then you would execute it without opening the GUI using the "run" function. The following is the documentation link:
If you still want to execute bash script using MATLAB only, then you can use the "system" function to do it:
matlab -nodisplay -nosplash -nodesktop -r "system('bash compile_lib.sh');exit;"

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by