Alert sound for warning me the program run overtime?

Is there any alert function in matlab?
My program will display a message on the command window when reaches the end of every loop. (one loop about 200 seconds)
I want to have alert sound if my matlab program doesn't update over a certain time (e.g. 200 seconds) So, I can be notified that my program has problem (run overtime) in that loop.
Thank!!

답변 (2개)

Image Analyst
Image Analyst 2015년 2월 19일

0 개 추천

Try soundsc(). Supply it with a filename of some sound you want it to play.

댓글 수: 2

SO
SO 2015년 2월 19일
Thank. But How can I count for the time? (start from last update of the command window) * I cannot put the script of the soundsc() function inside my main program (since sometimes it never stop like a infinite loop)
Are you still having trouble with this? You can use a timer to launch a sound or message box after a certain time. If it finishes before the warning time, you can stop the timer.

댓글을 달려면 로그인하십시오.

Andy
Andy 2015년 2월 19일
Set up a timer at the start of the code i.e.
alert=timer('TimerFcn','beep','StartDelay',200,'Name','Timer-1')
At the start of the loop set the timer running: -
start(alert)
To stop the beep sounding if the loop works, immediately before you display the message on the command line, stop the timer
stop(alert)

카테고리

도움말 센터File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

질문:

SO
2015년 2월 19일

댓글:

2015년 2월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by