diff --git a/matlab/dynare.m b/matlab/dynare.m
index 4ae72b8d5f07077113a687997aea475d420537ff..d5b86f54bb04adcce681cd21384d679ac4f081d7 100644
--- a/matlab/dynare.m
+++ b/matlab/dynare.m
@@ -152,7 +152,7 @@ end
 
 if ~isempty(strfind(fname,filesep))
     fprintf('\nIt seems you are trying to call a .mod file not located in the "Current Folder". This is not possible (the %s symbol is not allowed in the name of the .mod file).\n', filesep)
-    [pathtomodfile,basename,ext] = fileparts(fname);
+    [pathtomodfile,basename] = fileparts(fname);
     if exist(pathtomodfile,'dir')
         filesindirectory = dir(pathtomodfile);
         filesindirectory = struct2cell(filesindirectory);