Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

any application closing using matlab

Asked by PK

PK (view profile)

on 28 Nov 2012
Latest activity Edited by none

none (view profile)

on 9 Oct 2014

hello i want to know if some on have an idea what command to be used to close a ms-word document using matlab or some code to do that task the word document can be at any memory location of the disk and not only word but even for any other application

1 Comment

Jan Simon

Jan Simon (view profile)

on 28 Nov 2012

Please use dots to separate the sentences. The location of a file on the hard disk does not matter the problem: If you want to kill an application, this works even without an opened file.

PK

PK (view profile)

Products

4 Answers

Answer by Vishal Rane

Vishal Rane (view profile)

on 28 Nov 2012

This should help

!taskkill -f -im processname.exe

processname is the one listed in the task manager.

Type "TASKKILL /?" in the windows command prompt for details and more options.

Refer Link and the system command for more information.

2 Comments

PK

PK (view profile)

on 29 Nov 2012

Hello vishal I did not get what you are trying to say to close a application that is running on the taskbar.

none

none (view profile)

on 9 Oct 2014

dos('taskkill /F /IM acroRd32.exe');

Vishal Rane

Vishal Rane (view profile)

Answer by Kaustubha Govind

Kaustubha Govind (view profile)

on 28 Nov 2012

If the open application is a COM server, you might also be able to use the MATLAB COM API (Although I haven't tried this on my end):

    h = actxGetRunningServer('Word.Application');
    h.Quit();

1 Comment

PK

PK (view profile)

on 29 Nov 2012

hello Kaustubha Govind this did not work for me and am not asking for a server application but just a simple close ie., using winopen('patch for the document or appliction') can open a file or doc or any application am asking for a command that can close a existing opened file on the taskbar.

Kaustubha Govind

Kaustubha Govind (view profile)

Answer by Walter Roberson

Walter Roberson (view profile)

on 29 Nov 2012

Java Robot Class to automatically access the taskbar and trigger the commands to kill the task.

There is no simple command to do what you want.

0 Comments

Walter Roberson

Walter Roberson (view profile)

Answer by Babak

Babak (view profile)

on 29 Nov 2012

You need to execute a dos command. Here's a piece of MATLAB's help:

Please see the documentation on

 status = dos(command)

1 Comment

Walter Roberson

Walter Roberson (view profile)

on 29 Nov 2012

The dos() command and the system() command earlier suggested are the same thing.

Babak

Babak (view profile)

Contact us