============================================================== IS_INVALID: Boolean function indicating if a sequence of points is *not* sorted, i.e. is not monotonically increasing and hence invalid. Code written by Katherine Smith, 2003 GENERAL is_it = is_invalid(points) INPUT/S -points: The bump points. OUTPUT/S -is_it: equals 1 if points are invalid, 0 otherwsie PENDING WORK -Add a few comments to file. KNOWN BUG/S -None. COMMENT/S -Should return 'yes' or 'no' rather than 0 and 1 which (I believe) is bad Matlab practice. RELATED FUNCTION/S BUILD_1D_MODEL ABOUT -Created: November 23rd, 2003 -Last update: Novermber 25th, 2003 -Revision: 0.0.2 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function is_it = is_invalid(points) 0002 % ============================================================== 0003 % IS_INVALID: Boolean function indicating if a sequence of 0004 % points is *not* sorted, i.e. is not monotonically 0005 % increasing and hence invalid. 0006 % 0007 % Code written by Katherine Smith, 2003 0008 % 0009 % GENERAL 0010 % 0011 % is_it = is_invalid(points) 0012 % 0013 % INPUT/S 0014 % 0015 % -points: 0016 % The bump points. 0017 % 0018 % OUTPUT/S 0019 % 0020 % -is_it: 0021 % equals 1 if points are invalid, 0 otherwsie 0022 % 0023 % PENDING WORK 0024 % 0025 % -Add a few comments to file. 0026 % 0027 % KNOWN BUG/S 0028 % 0029 % -None. 0030 % 0031 % COMMENT/S 0032 % 0033 % -Should return 'yes' or 'no' rather than 0 and 1 which 0034 % (I believe) is bad Matlab practice. 0035 % 0036 % RELATED FUNCTION/S 0037 % 0038 % BUILD_1D_MODEL 0039 % 0040 % ABOUT 0041 % 0042 % -Created: November 23rd, 2003 0043 % -Last update: Novermber 25th, 2003 0044 % -Revision: 0.0.2 0045 % -Author: R. S. Schestowitz, University of Manchester 0046 % ============================================================== 0047 0048 [dummy, order] = sort(points); % sort it 0049 if(any(order' ~= 1:size(points,1))) % if any point after ordering does not correspond 0050 % to its position (numbered 1..maxsize) 0051 is_it = 1; 0052 else 0053 is_it = 0; 0054 end