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
32905b1c
Commit
32905b1c
authored
Nov 13, 2012
by
Stéphane Adjemian
Browse files
Added more complex calls to subsref overloaded method for dynDate class. Added unitary test.
parent
68a2ce4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
matlab/@dynDate/subsref.m
View file @
32905b1c
...
...
@@ -63,6 +63,19 @@ if isequal(length(S),1) && isequal(S.type,'.') && ( strcmp(S.subs,'time') || str
return
end
%
Allow
more
complex
call
to
subsref
such
that
:
%
%
a
=
dynDate
();
%
a
(
'
2009
M4
'
).
time
%
%
should
return
a
row
vector
[
2009
4
].
Note
that
the
object
name
should
not
match
any
function
name
%
declared
in
the
matlab
'
s
path
.
if
length
(
S
)
>
1
&&
isequal
(
S
(
1
).
type
,
'
()
'
)
&&
isequal
(
S
(
2
).
type
,
'.'
)
tmp
=
dynDate
(
S
(
1
).
subs
{
1
});
B
=
builtin
(
'
subsref
'
,
tmp
,
S
(
2
));
return
end
error
(
'
dynDate
::
subsref
:
You
''
re
trying
to
do
something
wrong
!
'
)
%
@test
:
1
...
...
@@ -113,3 +126,16 @@ error('dynDate::subsref: You''re trying to do something wrong!')
%
$
T
=
all
(
t
);
%
@eof
:
2
%
@test
:
3
%
$
%
Try
more
complex
call
to
overloaded
subsref
%
$
t
=
zeros
(
1
,
1
);
%
$
try
%
$
a
=
dynDate
();
%
$
time
=
a
(
'
1973
M1
'
).
time
;
%
$
t
(
1
)
=
1
;
%
$
catch
%
$
%
Nothing
to
do
here
.
%
$
end
%
$
%
$
T
=
all
(
t
);
%
@eof
:
3
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment