How do you run Matlab in batch mode in R2021b Update 2?
8 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Jan
2022 年 2 月 15 日
The run() command required the name of a Matlab script. "compile_lib.sh" does not sound like a Matlab script file name.
回答 (1 件)
Dinesh
2023 年 12 月 29 日
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;"
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!