]> Creatis software - CreaPhase.git/blob - octave_packages/nan-2.5.5/flag_nans_occured.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nan-2.5.5 / flag_nans_occured.m
1 function [flag]=flag_nans_occured()
2 % FLAG_NANS_OCCURED checks whether the last call(s) to sumskipnan or covm 
3 % contained any not-a-numbers in the input argument. Because many other 
4 % functions like mean, std, etc. are also using sumskipnan, 
5 % also these functions can be checked for NaN's in the input data. 
6
7 % A call to FLAG_NANS_OCCURED() resets also the flag whether NaN's occured. 
8 % Only sumskipnan or covm can set the flag again. 
9 %
10 % see also: SUMSKIPNAN, COVM
11
12 %       $Id$
13 %       Copyright (C) 2009 by Alois Schloegl <alois.schloegl@gmail.com> 
14 %       This function is part of the NaN-toolbox
15 %       http://pub.ist.ac.at/~schloegl/matlab/NaN/
16
17 %    This program is free software: you can redistribute it and/or modify
18 %    it under the terms of the GNU General Public License as published by
19 %    the Free Software Foundation, either version 3 of the License, or
20 %    (at your option) any later version.
21 %
22 %    This program is distributed in the hope that it will be useful,
23 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
24 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 %    GNU General Public License for more details.
26 %
27 %    You should have received a copy of the GNU General Public License
28 %    along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
30 global FLAG_NANS_OCCURED;
31
32 %%% check whether FLAG was already defined 
33 if isempty(FLAG_NANS_OCCURED),
34         FLAG_NANS_OCCURED = logical(0);  % default value 
35 end;
36
37 flag = FLAG_NANS_OCCURED;               % return value 
38
39 FLAG_NANS_OCCURED = logical(0);         % reset flag
40
41 return;