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

- 49,435
- 16
- 136
- 136

- 1,095
- 3
- 21
- 40
-
Do you need to use windows media player to open the file? If not, you can just use the "aviread" and "movie" functions in matlab. – Ghaul Feb 02 '11 at 13:36
3 Answers
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.

- 3,012
- 26
- 29
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.

- 23,127
- 2
- 43
- 62
-
thanks but I need to use winopen, as I need to get input from the keyboard while the movie is playing, and I didn't menage to do it with aviread() or other matlab functions. – user552231 Feb 02 '11 at 14:08
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.

- 1,290
- 1
- 11
- 19