From b5275edaa164720c1a6329d8a0efeab33ce5336e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Thu, 29 Jun 2017 22:13:50 +0200
Subject: [PATCH] Simplified test on {dyn, mod} extensions.

---
 matlab/dynare.m | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/matlab/dynare.m b/matlab/dynare.m
index 5517846fb..5e66c9b73 100644
--- a/matlab/dynare.m
+++ b/matlab/dynare.m
@@ -112,10 +112,8 @@ if isempty(strfind(fname,'.'))
     fname = fname1;
 else
     % Check provided file extension.
-    if dot_location~=length(fname)-3 ... %if the file name has fewer than 4 characters and there is a period
-            || ~strcmp(upper(fname(size(fname,2)-3:size(fname,2))),'.MOD') ...
-            && ~strcmp(upper(fname(size(fname,2)-3:size(fname,2))),'.DYN')
-        error('DYNARE: argument must be a filename with .mod or .dyn extension and must not include any other periods')
+    if ~strcmpi(fname(dot_location+1:end), 'mod') && ~strcmpi(fname(dot_location+1:end), 'dyn')
+        error('DYNARE: argument must be a filename with .mod or .dyn extensions')
     end
     fnamelength = length(fname) - 4;
 end
-- 
GitLab