Thread Subject: Closing DOS window from matlab

Subject: Closing DOS window from matlab

From: Quentin

Date: 10 Dec, 2008 05:24:02

Message: 1 of 2

Hello all,

I have a quick question and my internet searches haven't quite gotten me a solution yet. Seems like a real common problem.

I am running a .exe file within a for loop in matlab. I need matlab to start and stop this file each loop iteration. I can get matlab to run the code using !program.exe & and then have matlab close the program by sending a command to that programs via dde. The only problem with this is that the & command (which I need to give matlab access to the dde library) opens up a DOS window with each loop iteration. I need to do many loops so I would like a way to automatically close these windows within matlab. Anyone have an .m file or know of any commands I can use?

Thanks a ton!
quentin

Subject: Closing DOS window from matlab

From: Jeroen

Date: 6 Mar, 2009 15:53:01

Message: 2 of 2

Hi Quentin,

Just came across a similar issue. I solved it using a trick; made a .bat file which contains the following two lines:

yourprogram.exe
exit

If you call the .bat file from Matlab in the same way you would start a normal executable, the .exe will be run in a dos window, which should now close after the .exe has finished. I have no experience with the dde library, however.

Jeroen

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com