フィルターのクリア

Is there a way to play audio/run a script when matlab debugger stops at a breakpoint?

3 ビュー (過去 30 日間)
Hi, I would like matlab to play a sound or run a script when the program stops at a breakpoint. I run many copies of matlab simultaneously and it would great to be alerted when a particular script reaches a breakpoint. Does anyone know if this can be done?

採用された回答

Walter Roberson
Walter Roberson 2017 年 9 月 17 日
Write a small function
function t = notify()
beep();
t = true;
Now, when you set a breakpoint, make it a conditional breakpoint. For example instead of
dbstop at 18
use
dbstop at 18 if notify()
  1 件のコメント
Daniel Moss
Daniel Moss 2017 年 9 月 18 日
Thanks, that is great and when I clear the breakpoints it will be removed.

サインインしてコメントする。

その他の回答 (2 件)

Image Analyst
Image Analyst 2017 年 9 月 17 日
Yes. When you're in the editor and going to click on a particular line to set a breakpoint there, just put a line before that line that says
beep();
or you can call soundsc() or audioplayer
[y, Fs] = audioread(filename);
player = audioplayer(y, Fs);
play(player);
Once you've successfully debugger your program you can always remove those lines.

Jan
Jan 2017 年 9 月 17 日
This cannot work: What happens if the breakpoint is set in the code, which is called, when the breakpoint is reached? As soon as Matlab stops at the breakpoint, it stops the processing.
Note that Matlab's JIT acceleration cannot work efficiently, if breakpoints are set. This can slowdown the code by a factor of 2 or 20. Therefore if might be more useful to insert a specific command, which triggers the signal and stops by the keyboard command.

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by