Added condition (input must be a string) in isyearly, isquaterly, ismonthly and isweekly functions.

time-shift
Stéphane Adjemian (Charybdis) 2013-10-14 18:17:32 +02:00
parent 941d7b7c5d
commit 068564628d
4 changed files with 20 additions and 4 deletions

View File

@ -25,7 +25,11 @@ function b = ismonthly(str) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
b = ~isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$'));
if ischar(str)
b = ~isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$'));
else
b = 0;
end
%@test:1
%$

View File

@ -25,7 +25,11 @@ function b = isquaterly(str) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
b = ~isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$'));
if ischar(str)
b = ~isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$'));
else
b = 0;
end
%@test:1
%$

View File

@ -25,7 +25,11 @@ function b = isweekly(str) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
b = ~isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$'));
if ischar(str)
b = ~isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$'));
else
b = 0;
end
%@test:1
%$

View File

@ -25,7 +25,11 @@ function b = isyearly(str) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
b = ~isempty(regexp(str,'^-?[0-9]*[YyAa]$'));
if ischar(str)
b = ~isempty(regexp(str,'^-?[0-9]*[YyAa]$'));
else
b = 0;
end
%@test:1
%$