MATLAB: How to stop a music when you close a window

close windowsound

I'm using some music on my interface with the function audioread() but it doesn't stop when I close the window. Is there an easy way to do it ? Thank you for your answer.

Best Answer

Emmanuelle - I suspect that you are using sound to play your audio file. Instead, consider using the audio player which will allow you to stop the audio playback when you exit your window (GUI?).