Back to the main page.
Bug 393 - implement a warningonce function
Status | CLOSED FIXED |
Reported | 2011-01-12 13:50:00 +0100 |
Modified | 2011-02-23 13:51:09 +0100 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Windows |
Importance: | P1 enhancement |
Assigned to: | Jörn M. Horschig |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Robert Oostenveld - 2011-01-12 13:50:04 +0100
in order to avoid outputting the same warning to the screen multiple times
Jörn M. Horschig - 2011-01-26 10:55:49 +0100
% % Use as % warning_once(string) % or % warning_once(string, timeout) % or % warning_once(id, string, timeout) % where timeout should be inf if you don't want to see the warning ever % again. The default timeout value is 60 seconds. % % Can be used instead of the MATLAB built-in function WARNING, thus as% % s = warning_once(...) % or % warning_once(s) % where s is a structure with fields 'identifier' and 'state', storing the % state information. % In other words, warning_once accepts as an input the same structure it % returns as an output. This restores the states of warnings to their % previous values. % % Can also be used as % [s w] = warning_once(...) % where w is a boolean that indicates whether a warning as been % thrown or not.