isnat : finds if numbers in an array are natural (ie positive and non-zero integers) INPUT : list : array of numbers OUTPUT : naturalNumb : array of 1 and 0, with 1 where natural numbers are found in the list Copyright (C) 2016 Wiggins Lab Written by Paul Wiggins. University of Washington, 2016 This file is part of SuperSegger. SuperSegger is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SuperSegger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SuperSegger. If not, see <http://www.gnu.org/licenses/>.
0001 function [naturalNum] = isnat( list ) 0002 % isnat : finds if numbers in an array are natural (ie positive and 0003 % non-zero integers) 0004 % 0005 % INPUT : 0006 % list : array of numbers 0007 % OUTPUT : 0008 % naturalNumb : array of 1 and 0, with 1 where 0009 % natural numbers are found in the list 0010 % 0011 % Copyright (C) 2016 Wiggins Lab 0012 % Written by Paul Wiggins. 0013 % University of Washington, 2016 0014 % This file is part of SuperSegger. 0015 % 0016 % SuperSegger is free software: you can redistribute it and/or modify 0017 % it under the terms of the GNU General Public License as published by 0018 % the Free Software Foundation, either version 3 of the License, or 0019 % (at your option) any later version. 0020 % 0021 % SuperSegger is distributed in the hope that it will be useful, 0022 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0024 % GNU General Public License for more details. 0025 % 0026 % You should have received a copy of the GNU General Public License 0027 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0028 0029 0030 naturalNum = ~isnan( list ); 0031 naturalNum(naturalNum) = and((list(naturalNum)>0),... 0032 list(naturalNum)==floor(list(naturalNum))); 0033 0034 0035 end 0036