diff --git a/src/@dseries/subsample.m b/src/@dseries/subsample.m
index 270fb47a564bdde03e7aa243682cb664180bc2fa..2886b096c4d17aaf4a7eac1eb9809838423d4624 100644
--- a/src/@dseries/subsample.m
+++ b/src/@dseries/subsample.m
@@ -41,6 +41,10 @@ function p = subsample(o, d1, d2)  % --*-- 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/>.
 
+if nargin < 1 || nargin > 3
+    error('function takes 1 to 3 arguments')
+end
+
 if nargin == 1
     p = copy(o);
     return