2

I have this script (Run_Matlab_No_GUI.vbs) which is supposed to run a MATLAB file test.m.

test.m is supposed to produce a file test.txt.
I run it on a windows command window.

Here is the listing:

# Run_Matlab_No_GUI.vbs
Set ml = CreateObject("Matlab.Application")
ml.Visible = false
ml.Execute("test.m")
ml.Execute("pause(4)")
% test.m
a=1;
b=1;
c=a+b;
dlmwrite('C:\tmp\HEEDS1\test.txt',c);

Problem: it runs without errors but is not producing the text.txt file.

  • Path to MATLAB: C:\Program Files\MATLAB\R2015a\bin
  • Path to test.m: C:\tmp\HEEDS1

Command line is in the test.m folder

1 Answer 1

4

You can run MATLAB in no GUi mode through

matlab -nodesktop -nosplash -r test
Sign up to request clarification or add additional context in comments.

4 Comments

Did that. it still shows a Matlab command environment. Ran this "C:\Program Files\MATLAB\R2015a\bin\matlab.exe" -nodesktop -nosplash -noFigureWindows -r run('test.m'); end; quit
Consider adding -nodisplay
-nodisplay and -nodesktop are different, so try with -nodisplay as @Marouen suggests. You can find more information here.
@NaftaliHerscovici: try also putting your MATLAB command in quotes: -r "run('test.m'); end; quit".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.