# How do I run a matlab m-file from cmd without the command window opening?



## bradle95 (Jul 27, 2003)

I tried using the following command, "matlab -nodesktop -nofigurewindows -nodisplay -nosplash -logfile polyval.dat -r Matlab_WritetoFile &" which runs the file, however the command window still pops up. What command do I need to disallow the command window from popping up?


----------



## aewarnick (Sep 3, 2002)

Compile a C++ program and call ShellExecute.


----------



## bradle95 (Jul 27, 2003)

I am actually running Matlab from a VB program. I need a way to run Matlab without any Matlab window appearing. The command that I listed above does most of the work (when ran as a bat file), such as eliminating the splash screen and running the m-file, but the Matlab command window still pops up. How do I run the m-file without this occuring?


----------



## aewarnick (Sep 3, 2002)

That's probably something you'd want to ask the makers of matlab. Sorry I can't be of more help.


----------



## bradle95 (Jul 27, 2003)

Ok, thanks.


----------



## coderitr (Oct 12, 2003)

Use the vbHide constant on the Style parameter of the Shell function.


----------



## bradle95 (Jul 27, 2003)

I do hide the cmd window which is shelled to run the batch file to run the m-file inside matlab... A long obnoxious bandaide fix of a current problem. Then the matlab command window pops up. There should be a way to prevent this. I did find that I can close the window from the m-file itself after it is finished, so that will work for now. Ideally I would make is so the window never pops up in the first place. Thanks.


----------



## coderitr (Oct 12, 2003)

Okay. So you're running a program / batch file from VB that runs another batch file which runs matlab (whatever that is.) The second batch file is what is causing the window to pop up. Right? If so, I can't think of a way to do that unless you use your VB program to look for the window and hide it.


----------

