ALARM Displays an alarm message after a set time.
ALARM(T, MSG) displays a message after T seconds with a text message MSG. After T seconds, the computer will start beeping and display a dialog box with an option to Snooze. The beeping will stop after one minute or when the dialog box is closed. The snooze interval is 5 minutes and up to 10 snoozes are allowed. These values can be changed by ALARM(T, MSG, PROP, VAL, ...) where PROP can be one of the two:
'SnoozeInt' : snooze interval in seconds (default: 300)
'SnoozeCount' : number of maximum snoozes (default: 10)
T can also be a string of a specific time for the alarm. The string may be any of the following formats:
HH:MM, HH:MM:SS, HH:MM PM, HH:MM:SS PM.
If the date is specified, it is ignored. The alarm will go off at the next possible HH:MM:SS.
The dialog box is a QUESTDLG, which means that all execution will be halted until the user selects one of the buttons.
ALARM by itself will list all active alarms. It will display whether the alarm has not yet gone off (pending) or has been snoozed, the time til the next alarm, and the alarm message.
ALARM('-delete') will display the active alarms and give the option of deleting any of the alarms.
When an ALARM is initially defined, it can return the number of seconds before it will go off. Use semicolon to suppress this output.
This code uses a timer object, and it will delete itself once the alarm is turned off. Note that the timer can be deleted. When MATLAB closes, it will also be deleted and will NOT be restored at the next session. The purpose of this code is for a simple time reminder function for those long coding sessions one might have.
Example:
% alarm in 60 seconds
alarm(60, 'You can stop waiting now');
% alarm at 9 PM
alarm('9:00 PM', 'It''s 9 PM!!');
% snooze time of 3 minutes for a max of 5 snoozes
alarm(120, 'Hello!', 'SnoozeInt', 180, 'SnoozeCount', 5);
인용 양식
Jiro Doke (2024). ALARM (https://www.mathworks.com/matlabcentral/fileexchange/9018-alarm), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- MATLAB > Language Fundamentals > Data Types > Dates and Time > Clocks and Timers >
- MATLAB > App Building > Migrate GUIDE Apps > Dialog Boxes >
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!