# Sniffing the dynare version

**URL:** <https://forum.dynare.org/t/sniffing-the-dynare-version/575>\
**Category:** Dynare v4 (legacy)\
**Created:** [11 February 2008 12:53 UTC](https://forum.dynare.org/t/sniffing-the-dynare-version/575 "2008-02-11T12:53:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ripatti](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/c89c15/32.png) [@ripatti](https://forum.dynare.org/u/ripatti)\
**Post date:** [11 February 2008 12:53 UTC](https://forum.dynare.org/t/sniffing-the-dynare-version/575/1 "2008-02-11T12:53:46Z")

</div>

Dear Musketeers,

I am writing some matlab functions that I try to make general such that they work both with dynare 3 and 4. Is there an easy and neat way to sniff what is the dynare version that the user of those functions is utilizing?

Regards,  
Antti

---

<div class="post-metadata">

**Author:** ![MichelJuillard](https://forum.dynare.org/user_avatar/forum.dynare.org/micheljuillard/32/5318_2.png) [@MichelJuillard](https://forum.dynare.org/u/MichelJuillard)\
**Post date:** [12 February 2008 13:26 UTC](https://forum.dynare.org/t/sniffing-the-dynare-version/575/2 "2008-02-12T13:26:59Z")

</div>

Hi Antti,

check whether endo\_nbr exists as a global variable. Then you are in version 3

The preferred alternative would be to press us to port to version 4 whichever function you use in version 3 and that isn’t present in version 4. We should really think about getting off version 3.

Best

Michel

---

<div class="post-metadata">

**Author:** ![ripatti](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/c89c15/32.png) [@ripatti](https://forum.dynare.org/u/ripatti)\
**Post date:** [4 March 2008 11:17 UTC](https://forum.dynare.org/t/sniffing-the-dynare-version/575/3 "2008-03-04T11:17:44Z")

</div>

Thanks Michel!

Actually this was not quite trivial but the following code (isDynare4.m) should do the job:

```auto
function isit=isDynare4 
% returns TRUE if you are running dynare 4
global endo_nbr;
isit = isempty(endo_nbr); % in the case of Dynare 3 endo_nbr has a sensible value (?)
```

This is handy when the operation of a function depends on the dynare version.

Antti

---

<div class="post-metadata">

**Author:** ![MichelJuillard](https://forum.dynare.org/user_avatar/forum.dynare.org/micheljuillard/32/5318_2.png) [@MichelJuillard](https://forum.dynare.org/u/MichelJuillard)\
**Post date:** [10 March 2008 21:04 UTC](https://forum.dynare.org/t/sniffing-the-dynare-version/575/4 "2008-03-10T21:04:41Z")

</div>

Thanks Antti

M

---

<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:** [24 July 2017 13:30 UTC](https://forum.dynare.org/t/sniffing-the-dynare-version/575/5 "2017-07-24T13:30:58Z")

</div>

Closed on 24 July 2017 13:30 UTC


