Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
e18dc658
Commit
e18dc658
authored
Mar 15, 2013
by
Johannes Pfeifer
Browse files
Merge remote-tracking branch 'upstream/master'
parents
195ed8ba
fe882dfe
Changes
65
Hide whitespace changes
Inline
Side-by-side
matlab/@dynDate/colon.m
View file @
e18dc658
...
...
@@ -47,8 +47,6 @@ function sp = colon(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
nargin
~=
2
error
(
'
dynDate
::
colon
:
I
need
exactly
two
input
arguments
!
'
)
end
...
...
@@ -71,22 +69,6 @@ for t=1:n
a
=
+
a
;
sp
=
sp
.
append
(
a
);
end
%
$$$
if
a
==
b
%
Time
range
with
only
one
date
.
%
$$$
sp
=
dynDates
(
a
);
%
$$$
sp
=
sp
.
setFreq
(
a
.
freq
);
%
$$$
sp
=
sp
.
setSize
(
1
);
%
$$$
sp
=
sp
.
setTime
(
1
,
a
.
time
);
%
$$$
else
%
$$$
n
=
b
-
a
;
%
$$$
sp
=
dynDates
();
%
$$$
sp
=
sp
.
setFreq
(
a
.
freq
);
%
$$$
sp
=
sp
.
setSize
(
n
+
1
);
%
$$$
sp
=
sp
.
setTime
(
1
,
a
.
time
);
%
$$$
for
t
=
2
:
n
+
1
%
$$$
a
=
+
a
;
%
$$$
sp
=
sp
.
setTime
(
t
,
a
.
time
);
%
$$$
end
%
$$$
end
%
@test
:
1
%
$
%
Define
two
dates
...
...
matlab/@dynDate/display.m
View file @
e18dc658
...
...
@@ -17,5 +17,4 @@ function display(d)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
fprintf
(
'%s = <dynDate: %s>\n'
,
inputname
(
1
),
format
(
d
));
end
fprintf
(
'%s = <dynDate: %s>\n'
,
inputname
(
1
),
format
(
d
));
\ No newline at end of file
matlab/@dynDate/dynDate.m
View file @
e18dc658
function
date
=
dynDate
(
a
)
function
date
=
dynDate
(
a
,
b
)
%
@info
:
%!
@deftypefn
{
Function
File
}
{
@var
{
date
}
=
}
dynDate
(
@var
{
a
})
...
...
@@ -60,8 +60,6 @@ function date = dynDate(a)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
date
=
struct
;
date
.
freq
=
NaN
;
...
...
@@ -75,6 +73,7 @@ switch nargin
return
case
1
if
ischar
(
a
)
%
Weekly
,
Monthly
or
Quaterly
data
.
a
=
upper
(
a
);
if
length
(
a
)
>
1
quaterly
=
findstr
(
'Q'
,
a
);
monthly
=
findstr
(
'M'
,
a
);
...
...
@@ -129,6 +128,23 @@ switch nargin
error
(
'
dynDate
::
Can
''
t
instantiate
the
class
,
wrong
calling
sequence
!
'
)
end
end
case
2
%
provide
time
and
freq
to
instantiate
a
dynDate
object
date
=
dynDate
();
if
isnumeric
(
b
)
&&
isscalar
(
b
)
&&
(
b
==
1
||
b
==
4
||
b
==
12
||
b
==
52
)
date
.
freq
=
b
;
if
~
isnumeric
(
a
)
&&
size
(
a
)
~=
2
&&
size
(
a
,
2
)
~=
2
error
([
'
dynDate
:
:
Can
''
t
instantiate
the
class
!
The
first
argument
'
inputname
(
a
)
'
must
be
a
1
*
2
vector
of
integers
.
'
])
end
if
b
==
1
&&
a
(
2
)
~
1
error
([
'
dynDate
:
:
Can
''
t
instantiate
the
class
!
The
second
element
of
the
first
argument
'
inputname
(
a
)
'
must
be
equal
to
one
.
'
])
end
if
a
(
2
)
<=
0
||
a
(
2
)
>
b
error
([
'
dynDate
:
:
Can
''
t
instantiate
the
class
!
The
second
element
of
the
first
argument
'
inputname
(
a
)
'
must
be
<=
'
int2str
(
b
)
'.'
])
end
date
.
time
=
a
;
else
error
([
'
dynDate
:
:
Can
''
t
instantiate
the
class
!
The
second
argument
'
inputname
(
b
)
'
must
be
equal
to
1
,
4
,
12
or
52
.
'
])
end
otherwise
error
(
'
dynDate
::
Can
''
t
instantiate
the
class
,
wrong
calling
sequence
!
'
)
end
...
...
@@ -137,8 +153,8 @@ end
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
'
1950
Q2
'
;
%
$
date_3
=
'
1950
M
10
'
;
%
$
date_4
=
'
1950
W
50
'
;
%
$
date_3
=
'
1950
m
10
'
;
%
$
date_4
=
'
1950
w
50
'
;
%
$
date_5
=
'
1950
'
;
%
$
%
$
%
Define
expected
results
.
...
...
@@ -188,4 +204,37 @@ end
%
$
t
(
5
)
=
dyn_assert
(
all
(
isnan
(
mm
.
time
)),
1
);
%
$
t
(
6
)
=
dyn_assert
(
all
(
isnan
(
ww
.
time
)),
1
);
%
$
T
=
all
(
t
);
%
@eof
:
1
\ No newline at end of file
%
@eof
:
2
%
@test
:
3
%
$
%
Try
to
instatiate
dynDate
objects
.
%
$
try
%
$
a
=
dynDate
([
1950
1
],
4
);
%
$
t
(
1
)
=
1
;
%
$
catch
%
$
t
(
1
)
=
0
;
%
$
end
%
$
try
%
$
a
=
dynDate
([
1950
5
],
4
);
%
$
t
(
1
)
=
0
;
%
$
catch
%
$
t
(
1
)
=
1
;
%
$
end
%
$
T
=
all
(
t
);
%
@eof
:
3
%
@test
:
4
%
$
%
Instatiate
an
empty
objects
for
quaterly
,
monthly
and
weekly
dates
.
%
$
qq
=
dynDate
(
'q'
);
%
$
mm
=
dynDate
(
'm'
);
%
$
ww
=
dynDate
(
'w'
);
%
$
%
$
%
Check
the
results
.
%
$
t
(
1
)
=
dyn_assert
(
qq
.
freq
,
4
);
%
$
t
(
2
)
=
dyn_assert
(
mm
.
freq
,
12
);
%
$
t
(
3
)
=
dyn_assert
(
ww
.
freq
,
52
);
%
$
t
(
4
)
=
dyn_assert
(
all
(
isnan
(
qq
.
time
)),
1
);
%
$
t
(
5
)
=
dyn_assert
(
all
(
isnan
(
mm
.
time
)),
1
);
%
$
t
(
6
)
=
dyn_assert
(
all
(
isnan
(
ww
.
time
)),
1
);
%
$
T
=
all
(
t
);
%
@eof
:
4
matlab/@dynDate/eq.m
View file @
e18dc658
...
...
@@ -46,8 +46,6 @@ function c = eq(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
nargin
~=
2
error
(
'
dynDate
::
eq
:
I
need
exactly
two
input
arguments
!
'
)
end
...
...
@@ -57,14 +55,13 @@ if ~( isa(a,'dynDate') && isa(b,'dynDate'))
end
if
~
isequal
(
a
.
freq
,
b
.
freq
)
error
([
'
dynDate
:
:
eq
:
Input
arguments
'
inputname
(
1
)
'
and
'
inputname
(
2
)
'
have
no
common
frequencies
!
'
])
c
=
0
;
return
end
c
=
isequal
(
a
.
time
,
b
.
time
);
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
'
1950
Q2
'
;
...
...
@@ -80,10 +77,11 @@ c = isequal(a.time,b.time);
%
$
d5
=
dynDate
(
date_5
);
%
$
try
%
$
i1
=
(
d1
==
d2
);
%
$
t1
=
0
;
%
$
catch
%
$
t1
=
1
;
%
$
catch
%
$
t1
=
0
;
%
$
end
%
$
t1
=
t1
&
~
i1
;
%
$
i2
=
(
d2
==
d2
);
%
$
i3
=
(
d4
==
d5
);
%
$
...
...
@@ -94,3 +92,33 @@ c = isequal(a.time,b.time);
%
$
T
=
all
(
t
);
%
@eof
:
1
%
@test
:
2
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
'
1950
q2
'
;
%
$
date_3
=
'
1950
m10
'
;
%
$
date_4
=
'
1950
w50
'
;
%
$
date_5
=
'
1950
w32
'
;
%
$
%
$
%
Call
the
tested
routine
.
%
$
d1
=
dynDate
(
date_1
);
%
$
d2
=
dynDate
(
date_2
);
%
$
d3
=
dynDate
(
date_3
);
%
$
d4
=
dynDate
(
date_4
);
%
$
d5
=
dynDate
(
date_5
);
%
$
try
%
$
i1
=
(
d1
==
d2
);
%
$
t1
=
1
;
%
$
catch
%
$
t1
=
0
;
%
$
end
%
$
t1
=
t1
&
~
i1
;
%
$
i2
=
(
d2
==
d2
);
%
$
i3
=
(
d4
==
d5
);
%
$
%
$
%
Check
the
results
.
%
$
t
(
1
)
=
t1
;
%
$
t
(
2
)
=
dyn_assert
(
i2
,
1
);
%
$
t
(
3
)
=
dyn_assert
(
i3
,
0
);
%
$
T
=
all
(
t
);
%
@eof
:
2
\ No newline at end of file
matlab/@dynDate/format.m
View file @
e18dc658
...
...
@@ -69,8 +69,6 @@ switch date.freq
end
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
'
1950
Q2
'
;
...
...
@@ -89,4 +87,4 @@ end
%
$
t
(
3
)
=
dyn_assert
(
date_3
,
DATE_3
);
%
$
t
(
4
)
=
dyn_assert
(
date_4
,
DATE_4
);
%
$
T
=
all
(
t
);
%
@eof
:
1
%
@eof
:
1
\ No newline at end of file
matlab/@dynDate/ge.m
View file @
e18dc658
...
...
@@ -30,7 +30,7 @@ function c = ge(a,b)
%!
@end
deftypefn
%
@eod
:
%
Copyright
(
C
)
2011
Dynare
Team
%
Copyright
(
C
)
2011
,
2013
Dynare
Team
%
%
This
file
is
part
of
Dynare
.
%
...
...
@@ -47,8 +47,6 @@ function c = ge(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
a
>
b
c
=
1
;
else
...
...
@@ -60,8 +58,6 @@ else
end
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
'
1950
Q3
'
;
%
$
date_2
=
'
1950
Q3
'
;
...
...
@@ -84,4 +80,4 @@ end
%
$
t
(
3
)
=
dyn_assert
(
i3
,
0
);
%
$
t
(
4
)
=
dyn_assert
(
i4
,
1
);
%
$
T
=
all
(
t
);
%
@eof
:
1
%
@eof
:
1
\ No newline at end of file
matlab/@dynDate/gt.m
View file @
e18dc658
...
...
@@ -46,8 +46,6 @@ function c = gt(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
nargin
~=
2
error
(
'
dynDate
::
eq
:
I
need
exactly
two
input
arguments
!
'
)
end
...
...
@@ -73,8 +71,6 @@ else
end
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
'
1950
Q2
'
;
...
...
@@ -99,4 +95,4 @@ end
%
$
t
(
3
)
=
dyn_assert
(
i3
,
0
);
%
$
t
(
4
)
=
dyn_assert
(
i4
,
0
);
%
$
T
=
all
(
t
);
%
@eof
:
1
%
@eof
:
1
\ No newline at end of file
matlab/@dynDate/isempty.m
View file @
e18dc658
...
...
@@ -27,7 +27,7 @@ function b = isempty(a)
%!
@end
deftypefn
%
@eod
:
%
Copyright
(
C
)
2012
Dynare
Team
%
Copyright
(
C
)
2012
,
2013
Dynare
Team
%
%
This
file
is
part
of
Dynare
.
%
...
...
@@ -44,10 +44,16 @@ function b = isempty(a)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
~
isa
(
a
,
'
dynDate
'
)
error
([
'
dynDate
:
:
isempty
:
Input
argument
'
inputname
(
1
)
'
have
to
be
a
dynDate
object
!
'
])
end
b
=
all
(
isnan
(
a
.
time
))
&&
isnan
(
a
.
freq
);
\ No newline at end of file
b
=
all
(
isnan
(
a
.
time
))
&&
isnan
(
a
.
freq
);
%
@test
:
1
%
$
%
Instantiate
an
empty
dynDate
object
%
$
d
=
dynDate
();
%
$
%
Test
if
this
object
is
empty
%
$
t
(
1
)
=
isempty
(
d
);
%
$
T
=
all
(
t
);
%
@eof
:
1
\ No newline at end of file
matlab/@dynDate/le.m
View file @
e18dc658
...
...
@@ -30,7 +30,7 @@ function c = le(a,b)
%!
@end
deftypefn
%
@eod
:
%
Copyright
(
C
)
2011
Dynare
Team
%
Copyright
(
C
)
2011
,
2013
Dynare
Team
%
%
This
file
is
part
of
Dynare
.
%
...
...
@@ -47,8 +47,6 @@ function c = le(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
a
<
b
c
=
1
;
else
...
...
@@ -60,8 +58,6 @@ else
end
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
'
1950
Q3
'
;
%
$
date_2
=
'
1950
Q3
'
;
...
...
matlab/@dynDate/lt.m
View file @
e18dc658
...
...
@@ -46,8 +46,6 @@ function c = lt(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
nargin
~=
2
error
(
'
dynDate
::
eq
:
I
need
exactly
two
input
arguments
!
'
)
end
...
...
@@ -73,8 +71,6 @@ else
end
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
'
1950
Q2
'
;
...
...
matlab/@dynDate/max.m
View file @
e18dc658
...
...
@@ -46,8 +46,6 @@ function c = max(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
nargin
~=
2
error
(
'
dynDate
::
min
:
I
need
exactly
two
input
arguments
!
'
)
end
...
...
@@ -67,14 +65,12 @@ else
end
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
2000
;
%
$
date_3
=
'
1950
Q
2
'
;
%
$
date_3
=
'
1950
q
2
'
;
%
$
date_4
=
'
1950
Q3
'
;
%
$
date_5
=
'
1950
M
1
'
;
%
$
date_5
=
'
1950
m
1
'
;
%
$
date_6
=
'
1948
M6
'
;
%
$
%
$
%
Call
the
tested
routine
.
...
...
matlab/@dynDate/min.m
View file @
e18dc658
...
...
@@ -46,8 +46,6 @@ function c = min(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
nargin
~=
2
error
(
'
dynDate
::
min
:
I
need
exactly
two
input
arguments
!
'
)
end
...
...
@@ -67,8 +65,6 @@ else
end
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
2000
;
...
...
matlab/@dynDate/minus.m
View file @
e18dc658
...
...
@@ -31,7 +31,7 @@ function c = minus(a,b)
%!
@end
deftypefn
%
@eod
:
%
Copyright
(
C
)
2011
Dynare
Team
%
Copyright
(
C
)
2011
,
2013
Dynare
Team
%
%
This
file
is
part
of
Dynare
.
%
...
...
@@ -48,8 +48,6 @@ function c = minus(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
~
(
isa
(
a
,
'
dynDate
'
)
&&
isa
(
b
,
'
dynDate
'
)
)
error
([
'
dynDate
:
:
minus
:
Input
arguments
'
inputname
(
1
)
'
and
'
inputname
(
2
)
'
must
be
dynDate
objects
!
'
])
end
...
...
@@ -77,8 +75,6 @@ switch a.freq
end
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_0_1
=
1950
;
%
$
date_0_2
=
1950
;
...
...
matlab/@dynDate/ne.m
View file @
e18dc658
...
...
@@ -46,8 +46,6 @@ function c = ne(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
nargin
~=
2
error
(
'
dynDate
::
ne
:
I
need
exactly
two
input
arguments
!
'
)
end
...
...
@@ -63,11 +61,9 @@ end
c
=
~
isequal
(
a
.
time
,
b
.
time
);
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
'
1950
Q
2
'
;
%
$
date_2
=
'
1950
q
2
'
;
%
$
date_3
=
'
1950
M10
'
;
%
$
date_4
=
'
1950
W50
'
;
%
$
date_5
=
'
1950
W32
'
;
...
...
matlab/@dynDate/plus.m
View file @
e18dc658
...
...
@@ -31,7 +31,7 @@ function c = plus(a,b)
%!
@end
deftypefn
%
@eod
:
%
Copyright
(
C
)
2011
Dynare
Team
%
Copyright
(
C
)
2011
,
2013
Dynare
Team
%
%
This
file
is
part
of
Dynare
.
%
...
...
@@ -48,8 +48,6 @@ function c = plus(a,b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
AUTHORS
(
S
)
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
if
~
isa
(
a
,
'
dynDate
'
)
error
([
'
dynDate
:
:
plus
:
Input
argument
'
inputname
(
1
)
'
must
be
a
dynDate
object
!
'
])
end
...
...
@@ -58,7 +56,6 @@ if b<0 || ~isint(b)
error
([
'
dynDate
:
:
plus
:
Input
argument
'
inputname
(
2
)
'
must
be
a
positive
integer
'
])
end
if
b
==
0
c
=
a
;
return
...
...
@@ -80,8 +77,6 @@ switch a.freq
end
%
@test
:
1
%
$
addpath
..
/
matlab
%
$
%
$
%
Define
some
dates
%
$
date_1
=
1950
;
%
$
date_2
=
'
1950
Q4
'
;
...
...
matlab/@dynDate/subsasgn.m
View file @
e18dc658
...
...
@@ -17,5 +17,4 @@ function val = subsasgn(val, idx, rhs)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
error
(
'Members of dynDate class are private'
)
end
error
(
'dynDate::subsasgn: Members of dynDate class are private'
)
\ No newline at end of file
matlab/@dynDate/subsref.m
View file @
e18dc658
...
...
@@ -32,7 +32,7 @@ function B = subsref(A,S)
%!
@end
deftypefn
%
@eod
:
%
Copyright
(
C
)
2011
,
2012
Dynare
Team
%
Copyright
(
C
)
2011
,
2012
,
2013
Dynare
Team
%
%
This
file
is
part
of
Dynare
.
%
...
...
@@ -49,75 +49,98 @@ function B = subsref(A,S)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
%
Allow
to
populate
an
empty
dynDate
object
or
update
a
dynDate
object
if
isequal
(
length
(
S
),
1
)
&&
isequal
(
S
.
type
,
'
()
'
)
if
isequal
(
length
(
S
.
subs
),
1
)
&&
ischar
(
S
.
subs
{
1
})
B
=
dynDate
(
S
.
subs
{
1
});
return
elseif
isequal
(
length
(
S
.
subs
),
1
)
&&
isnumeric
(
S
.
subs
{
1
})
%
Yearly
data
are
assumed
.
if
isequal
(
A
.
freq
,
1
)
B
=
dynDate
(
S
.
subs
{
1
});
return
end
elseif
isequal
(
length
(
S
.
subs
),
2
)
&&
isequal
(
length
(
S
.
subs
{
1
}),
1
)
&&
isequal
(
length
(
S
.
subs
{
2
}),
1
)
tmp
=
[];
switch
A
.
freq
case
4
%
Quaterly
data
if
S
.
subs
{
2
}
<
5
&&
S
.
subs
{
2
}
>
0
tmp
=
[
num2str
(
S
.
subs
{
1
}
),
'Q'
num2str
(
S
.
subs
{
2
}
)];
end
case
12
%
Monthly
data
if
S
.
subs
{
2
}
<
13
&&
S
.
subs
{
2
}
>
0
tmp
=
[
num2str
(
S
.
subs
{
1
}
),
'M'
num2str
(
S
.
subs
{
2
}
)];
switch
S
(
1
).
type
case
'.'
switch
S
(
1
).
subs
case
'
format
'
B
=
format
(
A
);
case
{'
time
'
,
'
freq
'}
B
=
builtin
(
'
subsref
'
,
A
,
S
(
1
));
otherwise
error
(
'
dynDate
:
:
subsref
:
Unknown
public
member
of
method
!
'
)
end
case
'
()
'
switch
length
(
S
(
1
).
subs
)
case
1
if
ischar
(
S
(
1
).
subs
{
1
}
)
if
numel
(
S
(
1
).
subs
{
1
}
)
==
1
&&
isempty
(
strmatch
(
S
(
1
).
subs
{
1
}
,
{
'W'
,
'M'
,
'Q'
,
'Y'
}
,
'
exact
'
))
error
([
'
dynDate
:
:
subsref
:
To
set
the
frequency
,
the
input
argument
of
dynDate
object
'''
inputname
(
1
)
'''
should
be
'
'W'
'
,
'
'M'
'
,
'
'Q'
'
or
'
'Y''.'
])
end
case
52
%
Weekly
data
if
S
.
subs
{
2
}
<
53
&&
S
.
subs
{
2
}
>
0
tmp
=
[
num2str
(
S
.
subs
{
1
}
),
'W'
num2str
(
S
.
subs
{
2
}
)];
%
Set
the
frequency
(
if
numel
==
1
)
of
an
empty
dynDate
object
or
set
the
date
(
if
numel
>
1
).
B
=
dynDate
(
S
(
1
).
subs
{
1
}
);
elseif
isnumeric
(
S
(
1
).
subs
{
1
}
)
&&
isscalar
(
S
(
1
).
subs
{
1
}
)
&&
isint
(
S
(
1
).
subs
{
1
}
)
if
(
~
isnan
(
A
.
freq
)
&&
A
.
freq
==
1
)
||
isnan
(
A
.
freq
)
B
=
dynDate
(
S
(
1
).
subs
{
1
}
);
else
error
([
'
dynDate
:
:
subsref
:
dynDate
object
'''
inputname
(
1
)
'''
was
not
instantiated
for
years
.
'
])
end
otherwi
se
%
el
se
error
(
'
dynDate
::
subsref
:
Something
is
wrong
in
your
syntax
!
'
)
end
if
~
isempty
(
tmp
)
B
=
dynDate
(
tmp
);
return
case
2
%
Populate
an
empty
dynDate
object
if
isnan
(
A
.
freq
)
error
([
'
dynDate
:
:
subsref
:
I
cannot
interpret
the
two
inputs
of
dynDate
object
'''
inputname
(
1
)
'''
because
frequency
is
not
set
.
'
])
else
tmp
=
[];
switch
A
.
freq
case
4
%
Quaterly
data
if
isint
(
S
(
1
).
subs
{
2
}
)
&&
isint
(
S
(
1
).
subs
{
1
}
)
&&
S
(
1
).
subs
{
2
}
<
5
&&
S
(
1
).
subs
{
2
}
>
0
tmp
=
[
int2str
(
S
(
1
).
subs
{
1
}
),
'Q'
int2str
(
S
(
1
).
subs
{
2
}
)];
else
if
~
isint
(
S
(
1
).
subs
{
2
}
)
||
~
(
S
(
1
).
subs
{
2
}
<
5
&&
S
(
1
).
subs
{
2
}
>
0
)
error
([
'
dynDate
:
:
subsref
:
The
second
input
argument
of
dynDate
object
'''
inputname
(
1
)
'''
(
'
num2str
(
S
(
1
).
subs
{
2
}
)
'
)
should
be
a
positive
integer
less
than
or
equal
to
4
.
'
])
end
if
~
isint
(
S
(
1
).
subs
{
2
}
)
error
([
'
dynDate
:
:
subsref
:
The
first
input
argument
of
dynDate
object
'''
inputname
(
1
)
'''
(
'
num2str
(
S
(
1
).
subs
{
1
}
)
'
)
should
be
an
integer
.
'
])
end
end
case
12
%
Monthly
data
if
isint
(
S
(
1
).
subs
{
2
}
)
&&
isint
(
S
(
1
).
subs
{
1
}
)
&&
S
(
1
).
subs
{
2
}
<
13
&&
S
(
1
).
subs
{
2
}
>
0
tmp
=
[
num2str
(
S
(
1
).
subs
{
1
}
),
'M'
num2str
(
S
(
1
).
subs
{
2
}
)];
else
if
~
isint
(
S
(
1
).
subs
{
2
}
)
||
~
(
S
(
1
).
subs
{
2
}
<
13
&&
S
(
1
).
subs
{
2
}
>
0
)
error
([
'
dynDate
:
:
subsref
:
The
second
input
argument
of
dynDate
object
'''
inputname
(
1
)
'''
(
'
num2str
(
S
(
1
).
subs
{
2
}
)
'
)
should
be
a
positive
integer
less
than
or
equal
to
12
.
'
])
end
if
~
isint
(
S
(
1
).
subs
{
2
}
)
error
([
'
dynDate
:
:
subsref
:
The
first
input
argument
of
dynDate
object
'''
inputname
(
1
)
'''
(
'
num2str
(
S
(
1
).
subs
{
1
}
)
'
)
should
be
an
integer
.
'
])
<