diff --git a/configure.ac b/configure.ac
index 9fdeab7bffc146f34486d439ea8a7b6c40a4952d..d46d22cb67a9db70d5034c8d79bb59cf889d9467 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,13 +137,7 @@ AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation
 if test "x$enable_matlab" = "xyes"; then
   AC_CONFIG_SUBDIRS([mex/build/matlab])
   AX_MATLAB
-  AX_MATLAB_ARCH
-  if test "${MATLAB_ARCH}" = win32 -o "${MATLAB_ARCH}" = win64; then
-    MATLAB_BATCH_OPTIONS='-nosplash -automation -wait -sd "$(CURDIR)"'
-  else
-    MATLAB_BATCH_OPTIONS='-nosplash -nodisplay'
-  fi
-  AC_SUBST([MATLAB_BATCH_OPTIONS])
+  AX_MATLAB_BATCH_OPTIONS
 fi
 AM_CONDITIONAL([ENABLE_MATLAB], [test "x$enable_matlab" = "xyes"])
 AM_CONDITIONAL([HAVE_CMD_LINE_MATLAB], [test "x$ax_enable_matlab" = "xyes" -a "x$have_windows" = "x"])
diff --git a/m4/ax_matlab_batch_options.m4 b/m4/ax_matlab_batch_options.m4
new file mode 100644
index 0000000000000000000000000000000000000000..46c366bc26e79d77dcb6885c7278aa500ee6248c
--- /dev/null
+++ b/m4/ax_matlab_batch_options.m4
@@ -0,0 +1,35 @@
+dnl Copyright (C) 2019 Dynare Team
+dnl
+dnl This file is part of Dynare.
+dnl
+dnl Dynare is free software: you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl Dynare is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+AC_DEFUN([AX_MATLAB_BATCH_OPTIONS],
+[dnl
+AC_REQUIRE([AX_MATLAB])
+AC_REQUIRE([AX_MATLAB_ARCH])
+AC_REQUIRE([AX_MATLAB_VERSION])
+
+AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [9.6],
+  [MATLAB_BATCH_OPTIONS='-batch'],
+  [
+    if test "${MATLAB_ARCH}" = win32 -o "${MATLAB_ARCH}" = win64; then
+      MATLAB_BATCH_OPTIONS='-nosplash -automation -wait -sd "$(CURDIR)" -r'
+    else
+      MATLAB_BATCH_OPTIONS='-nosplash -nodisplay -r'
+    fi
+  ])
+
+AC_SUBST([MATLAB_BATCH_OPTIONS])
+])
diff --git a/m4/ax_matlab_version.m4 b/m4/ax_matlab_version.m4
index cbd6325b109bd0123254dcb0f47ce55ecbb7b1d8..e36a9c949fa8337c02d55e9f173072ce9cf67e94 100644
--- a/m4/ax_matlab_version.m4
+++ b/m4/ax_matlab_version.m4
@@ -22,6 +22,9 @@ AC_REQUIRE([AX_MATLAB])
 AC_MSG_CHECKING([for MATLAB version])
 if test "x$MATLAB_VERSION" != "x"; then
   case $MATLAB_VERSION in
+    *2019a | *2019A)
+      MATLAB_VERSION="9.6"
+      ;;
     *2018b | *2018B)
       MATLAB_VERSION="9.5"
       ;;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 27815683a9e2b587d8cd8fe20e6d0437118099b6..6760824a683397f052044076ee3eada16ffa622b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -882,7 +882,7 @@ check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
 %.m.trs %.m.log: %.mod
 	@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
-		$(MATLAB)/bin/matlab $(MATLAB_BATCH_OPTIONS) -r run_test_matlab > $*.m.log  2> /dev/null || \
+		$(MATLAB)/bin/matlab $(MATLAB_BATCH_OPTIONS) run_test_matlab > $*.m.log  2> /dev/null || \
 	printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:elapsed-time: 0.0\n" > $*.m.trs
 	@if test -z "$(filter $*.m.trs,$(M_XFAIL_TRS_FILES))"; then pass_color=2; fail_color=1; else pass_color=1; fail_color=2; fi; \
 	if grep -q ":test-result: PASS" $*.m.trs; then \
@@ -897,7 +897,7 @@ check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
 %.m.trs %.m.log : %.m
 	@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" \
-		$(MATLAB)/bin/matlab $(MATLAB_BATCH_OPTIONS) -r $* > $*.m.log 2> /dev/null
+		$(MATLAB)/bin/matlab $(MATLAB_BATCH_OPTIONS) $* > $*.m.log 2> /dev/null
 	@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$* Done!`tput sgr0`"
 
 %.o.trs %.o.log: %.mod
@@ -925,7 +925,7 @@ check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
 %.m.tls : %.m
 	@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
 	@TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
-		$(MATLAB)/bin/matlab $(MATLAB_BATCH_OPTIONS) -r run_m_script >/dev/null 2>&1
+		$(MATLAB)/bin/matlab $(MATLAB_BATCH_OPTIONS) run_m_script >/dev/null 2>&1
 	@touch $*.m.tls
 	@echo "`tput bold`MATLAB`tput setaf 8`: $(CURDIR)/$* Done!`tput sgr0`"
 
diff --git a/windows/dynare.nsi b/windows/dynare.nsi
index a4e4d6154a637007646df642c5c11b6fae69b1c0..2e26acc119d3f46a8ed18e660b07dd4e86cdaf2b 100644
--- a/windows/dynare.nsi
+++ b/windows/dynare.nsi
@@ -98,9 +98,9 @@ Section "MEX files for MATLAB 64-bit, version 7.9 to 9.3 (R2009b to R2017b)"
  File ..\mex\matlab\win64-7.9-9.3\*.mexw64
 SectionEnd
 
-Section "MEX files for MATLAB 64-bit, version 9.4 to 9.5 (R2018a to R2018b)"
- SetOutPath $INSTDIR\mex\matlab\win64-9.4-9.5
- File ..\mex\matlab\win64-9.4-9.5\*.mexw64
+Section "MEX files for MATLAB 64-bit, version 9.4 to 9.5 (R2018a to R2019a)"
+ SetOutPath $INSTDIR\mex\matlab\win64-9.4-9.6
+ File ..\mex\matlab\win64-9.4-9.6\*.mexw64
 SectionEnd
 
 SectionGroupEnd