How to run a MATLAB file without opening the MATLAB GUI?
20 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to test a batch file that runs matlab with an input file
the batch file is one line:
"C:\Program Files\MATLAB\R2024b\bin\matlab.exe" -noFigureWindows -minimize -nosplash -r "c:\tmp\test\test_matlab_no_GUI_batch.m"
the MATLAB file is:
a=6;
b=7;
c=a+b;
dlmwrite('c:\tmp\test\HFSS_Batch\test_matlab_no_gui.txt',c)
I would expect to see the "test_matlab_no_gui.txt" file in "c:\tmp\test\" folder.
I am not. what am I missing?
Thank you
0 个评论
采纳的回答
Mike Croucher
2025-2-27
编辑:Mike Croucher
2025-2-27
You need to wrap your script in a run command. I also suggest using the newer, -batch switch
"C:\Program Files\MATLAB\R2024b\bin\matlab.exe" -batch "run('C:\Users\walki\battest.m')"
Alternatively, add your directory to the MATLAB path before running the script. Like this
"C:\Program Files\MATLAB\R2024b\bin\matlab.exe" -batch "addpath('C:\Users\walki\');battest"
2 个评论
更多回答(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!