# Not enough input arguments ==\> if isinteger(x)

**URL:** <https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761>\
**Category:** Stochastic simulations\
**Created:** [30 March 2021 12:14 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761 "2021-03-30T12:14:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohamed](https://forum.dynare.org/user_avatar/forum.dynare.org/mohamed/32/10717_2.png) [@Mohamed](https://forum.dynare.org/u/Mohamed)\
**Post date:** [30 March 2021 12:14 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/1 "2021-03-30T12:14:20Z")

</div>

Dear everyone!

I am comparing two models and I get the following error:  
Not enough input arguments.

Error in var (line 73)

if isinteger(x)

Error in compa\_4 (line 21)

for jj=1:length(var)

My code is:  
dynare thesimy.mod;  
irf1 = oo\_.irfs;  
save thesimy.mat irf1;  
dynare thesimy2.mod;  
irf2 = oo\_.irfs;  
save thesimy2.mat irf2;  
load(‘thesimy.mat’,‘irf1’);  
load(‘thesimy2.mat’,‘irf2’);  
ending\_cell={’\_eps\_a’,’\_eps\_r’,’\_eps\_g’,‘_eps\_tau’};  
%‘Hiato do produto’, ‘Inflação Doméstico’, ‘Consumo Doméstico’,  
%‘PIB’,‘Inflação IP’,‘Termo de Troca’, ‘Salário Real’, ‘Horas de  
%Trabalho’,‘Dívida’,‘Câmbio Nominal’,‘Balanço Comercial’,‘Taxa de Juros Real’  
for ii=1:length(ending\_cell)  
HOR=1:options_.irf;  
var\_titles = {‘Hiato do produto’, ‘Inflação Doméstico’, ‘Consumo Doméstico’, ‘PIB’, ‘Inflação IPC’, ‘Termo de Troca’, ‘Salário Real’, ‘Horas de Trabalho’,‘Dívida’, ‘Câmbio Nominal’,‘Balanço Comercial’,‘Taxa de Juros Real’};  
figure  
for jj=1:length(var)  
subplot(4,4,jj)  
eval([‘irf1.’ var{1,jj},ending\_cell{1,ii}]);  
eval([‘irf2.’ var{1,jj},ending\_cell{1,ii}]);  
hold on  
plot(HOR,[eval([‘irf1.’ var{1,jj},ending\_cell{1,ii}])],’-k’,HOR,[eval([‘irf2.’ var{1,jj},ending\_cell{1,ii}])],’–r’,‘LineWidth’,2);  
title([var\_titles{1,jj}] )  
end  
legend(‘Modelo com HP’, ‘Modelo com TC’, ‘AutoUpdate’,‘off’)  
end

Var is a function and var\_titles is a variable.

When I put some variables (a small number of variables, 5 variables for example) in var\_titles (1, 2, …5), the model executes normally without any problem. But when I put a lot of variables (12 variables for example ) in var\_titles(1, 2, 3 …12), the model shows the above problem.

Thank you for helping to resolve the issue.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [31 March 2021 07:51 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/2 "2021-03-31T07:51:29Z")

</div>

Without the full files it is impossible to tell.

---

<div class="post-metadata">

**Author:** ![Mohamed](https://forum.dynare.org/user_avatar/forum.dynare.org/mohamed/32/10717_2.png) [@Mohamed](https://forum.dynare.org/u/Mohamed)\
**Post date:** [31 March 2021 12:09 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/3 "2021-03-31T12:09:54Z")

</div>

Thank you very much Professor.  
Here is the full files.  
[thesimyp1.mod](https://forum.dynare.org/uploads/short-url/x7MNU0I6Zc48B6BlI7iJeCZtus7.mod) (5.0 KB)  
[thesimyp2.mod](https://forum.dynare.org/uploads/short-url/wKncRC1x5dxU8k3BocJR4glbQE9.mod) (5.0 KB)  
[compa\_4.m](https://forum.dynare.org/uploads/short-url/sCFsOYlL4WAQ5lgbWdMEXHtYnPw.m) (1.2 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [31 March 2021 15:20 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/4 "2021-03-31T15:20:02Z")

</div>

You did not define any variables for `var`, so Matlab thinks it is the command for computing the variance.

---

<div class="post-metadata">

**Author:** ![Mohamed](https://forum.dynare.org/user_avatar/forum.dynare.org/mohamed/32/10717_2.png) [@Mohamed](https://forum.dynare.org/u/Mohamed)\
**Post date:** [2 April 2021 00:28 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/5 "2021-04-02T00:28:44Z")

</div>

Dear Professor!

I tried to create a scalar structure to resolve the ‘‘var’’ problem.

I received the following error:

Error using copyfile

Cannot write to destination: C:\Users\abdel\Documents. Use the ‘f’ option to override.

Error in testcom (line 12)

copyfile(‘S1.mat’,‘S3.mat’)

Please take a look at what I did.

dynare thesimyp1.mod;

irf1 = oo\_.irfs;

S1 = ‘thesimyp1’;

save S1.mat S1

dynare thesimyp2.mod;

irf2 = oo\_.irfs;

S2 = ‘thesimyp2’;

save S2.mat S2

copyfile(‘S1.mat’,‘S3.mat’)

S = load(‘S2.mat’);

save(‘S3.mat’,’-struct’,‘S’,’-append’)

ending\_cell={’\_eps\_a’,’\_eps\_r’,’\_eps\_g’,’\_eps\_tau’};

%‘Hiato do produto’, ‘Inflação Doméstico’, ‘Consumo Doméstico’,

%‘PIB’,‘Inflação IP’,‘Termo de Troca’, ‘Salário Real’, 'Horas de

%Trabalho’,‘Dívida’,‘Câmbio Nominal’,‘Balanço Comercial’,‘Taxa de Juros Real’

for ii=1:length(ending\_cell)

HOR=1:options\_.irf;

var\_titles = {‘Hiato do produto’, ‘Inflação Doméstico’, ‘Consumo Doméstico’, ‘PIB’, ‘Inflação IPC’, ‘Termo de Troca’, ‘Salário Real’, ‘Horas de Trabalho’,‘Dívida’, ‘Câmbio Nominal’,‘Balanço Comercial’,‘Taxa de Juros Real’};

figure

for jj=1:length(S)

subplot(3,3,jj)

irf1.([S{1,jj},ending\_cell{1,ii}]);

irf2.([S{1,jj},ending\_cell{1,ii}]);

hold on

plot(HOR,[([‘irf1.’ S{1,jj},ending\_cell{1,ii}])],’-k’,HOR,[([‘irf2.’ S{1,jj},ending\_cell{1,ii}])],’–r’,‘LineWidth’,2);

title([var\_titles{1,jj}])

end

legend(‘Modelo com HP’, ‘Modelo com TC’, ‘AutoUpdate’,‘off’)

end

Professor, my objective is to do a similar figure.

 ![Sem título](https://forum.dynare.org/uploads/default/original/2X/6/6610193675f80afbe527f386b801fead5571a6e1.png)

I appreciate any kind of help.

Best regard,

---

<div class="post-metadata">

**Author:** ![DoubleBass](https://forum.dynare.org/user_avatar/forum.dynare.org/doublebass/32/17420_2.png) [@DoubleBass](https://forum.dynare.org/u/DoubleBass)\
**Post date:** [2 April 2021 08:40 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/6 "2021-04-02T08:40:17Z")

</div>

Hi Mohamed,

you asked this question before and I send you code that does just that, why not just ask there if something is unclear? ([Subplot construction - #2 by DoubleBass](https://forum.dynare.org/t/subplot-construction/17479/2))  
It should do just what you are trying to achieve, what is the exact problem?

In the code you linked above, as is also explained in the pseudo code I linked,

> var = {}

contains the variables with the names you gave them in Dynare, not how you want them to be called afterwards. This is how Matlab evaluates them when you use

> eval([‘irf1.’ var{1,jj},ending\_cell{1,ii}])

Just look at the structures you create in irf1 for each variable. This is exactly what jpfeifer meant when he said that you did not define any variables for var. Hope this helps, otherwise just feel free to ask.

Best

---

<div class="post-metadata">

**Author:** ![Mohamed](https://forum.dynare.org/user_avatar/forum.dynare.org/mohamed/32/10717_2.png) [@Mohamed](https://forum.dynare.org/u/Mohamed)\
**Post date:** [2 April 2021 14:09 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/7 "2021-04-02T14:09:43Z")

</div>

Dear @DoubleBass!  
Thank you very much for your reply.  
When I try to do with exact variable names inserted in the Dynare, I get the following error:

\<\< Error using plot  
Vectors must be the same length.  
Error in compa\_4 (line 26)  
plot(HOR,[eval([‘irf1.’ var{1,jj},ending\_cell{1,ii}])],’-k’,HOR,[eval([‘irf2.’ var{1,jj},ending\_cell{1,ii}])],’–r’,‘LineWidth’,2); \>\>

My code is:

dynare thesimyp1.mod;  
irf1 = oo\_.irfs;  
save thesimyp1.mat irf1;

dynare thesimyp2.mod;  
irf2 = oo\_.irfs;  
save thesimyp2.mat irf2;

load(‘thesimyp1.mat’,‘irf1’);  
load(‘thesimyp2.mat’,‘irf2’);

ending\_cell={’\_eps\_a’,’\_eps\_r’,’\_eps\_g’,’\_eps\_tau’};

%‘ytil’, ‘pid’, ‘c’,‘ybreve’,‘pi’,‘h’, ‘real\_wage’, ‘l’,‘b’,‘e’,‘bc’,‘rr’

for ii=1:length(ending\_cell)  
HOR=1:options\_.irf;  
var = {‘ytil’, ‘pid’, ‘c’,‘ybreve’,‘pi’,‘h’, ‘real\_wage’, ‘l’,‘b’,‘e’,‘bc’,‘rr’};  
figure  
for jj=1:length(var)  
subplot(3,3,jj)  
eval([‘irf1.’ var{1,jj},ending\_cell{1,ii}]);  
eval([‘irf2.’ var{1,jj},ending\_cell{1,ii}]);  
hold on  
plot(HOR,[eval([‘irf1.’ var{1,jj},ending\_cell{1,ii}])],’-k’,HOR,[eval([‘irf2.’ var{1,jj},ending\_cell{1,ii}])],’–r’,‘LineWidth’,2);  
title([var{1,jj}] )  
end

```
legend('modelo hp', 'modelo tc', 'AutoUpdate','off')

```

end

Best regard,

---

<div class="post-metadata">

**Author:** ![Mohamed](https://forum.dynare.org/user_avatar/forum.dynare.org/mohamed/32/10717_2.png) [@Mohamed](https://forum.dynare.org/u/Mohamed)\
**Post date:** [2 April 2021 14:34 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/8 "2021-04-02T14:34:11Z")

</div>

When I put some variables (a small number of variables, 5 variables for example) in var\_titles (1, 2, … 5), the model runs normally without any problems. Either with the proper names of the variables or with any other names that I want the variables to be called.

But when I put many variables (12 variables, for example) in var\_titles (1, 2, 3… 12), the model shows the following problem:

Not enough input arguments.  
Error in var (line 73)  
if isinteger(x)  
Error in compa\_4 (line 21)  
for jj=1:length(var)

Note that in this case, the names of the variables are different from the original names of the variables.

When I put a large number of variables using ‘’ var ‘’, with the proper names variables, I get the following error:

Error using plot  
Vectors must be the same length.  
Error in compa\_4 (line 26)  
plot(HOR,[eval([‘irf1.’ var{1,jj},ending\_cell{1,ii}])],’-k’,HOR,[eval([‘irf2.’ var{1,jj},ending\_cell{1,ii}])],’–r’,‘LineWidth’,2);

---

<div class="post-metadata">

**Author:** ![DoubleBass](https://forum.dynare.org/user_avatar/forum.dynare.org/doublebass/32/17420_2.png) [@DoubleBass](https://forum.dynare.org/u/DoubleBass)\
**Post date:** [2 April 2021 15:54 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/9 "2021-04-02T15:54:59Z")

</div>

Hi Mohamed,

you have to put the same length of your IRF’s in stoch\_simul(). This is what causes the problems, in thesimyp1.mod it was irf=10 and in thesimyp1.mod it was irf=20.  
For it works after adjusting this.

Best

---

<div class="post-metadata">

**Author:** ![Mohamed](https://forum.dynare.org/user_avatar/forum.dynare.org/mohamed/32/10717_2.png) [@Mohamed](https://forum.dynare.org/u/Mohamed)\
**Post date:** [2 April 2021 17:12 UTC](https://forum.dynare.org/t/not-enough-input-arguments-if-isinteger-x/17761/10 "2021-04-02T17:12:59Z")

</div>

Dear @DoubleBass!  
My model worked well. Thank you very much for your help.
