user552231
user552231

Reputation: 1135

Close Windows Media Player with MATLAB

I used winopen('filename') to open an AVI file using the Windows Media Player. How can I close it?

Upvotes: 1

Views: 1191

Answers (3)

MatlabSorter
MatlabSorter

Reputation: 1300

Might be tough to do easily. I thought there would be a way using Matlab's dos command and the appropriate parameters, but the recent version of WMP doesn't have a close after play command (see WMP Command Line Parameters). This is odd, since I found older documentation that does reference a /close parameter, but it doesn't work with Win7.

If you are desperate, you should be able to use the COM interface to get it done, but this is a trickier task.

Upvotes: 0

Clement J.
Clement J.

Reputation: 3032

There is tkill command on Windows to kill a task. You can use it with system(). You have to find a method to kill only "your" WMP if several can coexist.

Upvotes: 3

kenm
kenm

Reputation: 23905

If you want to control movie playback in MATLAB, use MATLAB itself to play the movie.

You can use mmreader to do this. An example is provided in the documentation.

Note that in older versions of MATLAB, you'll need to use aviread instead. Also, as mentioned in the above link, mmreader is being renamed to VideoReader in future versions of MATLAB.

Upvotes: 1

Related Questions