Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
94ee91bd
Commit
94ee91bd
authored
10 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Patches
Plain Diff
Allow dates objects as first and third arguments (initial and terminal dates).
parent
2d7d1008
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/utilities/dseries/from.m
+34
-9
34 additions, 9 deletions
matlab/utilities/dseries/from.m
with
34 additions
and
9 deletions
matlab/utilities/dseries/from.m
+
34
−
9
View file @
94ee91bd
...
...
@@ -27,28 +27,53 @@ if isempty(to_id) || isempty(do_id)
end
if
do_id
<
to_id
msg
=
sprinf
(
'Wrong syntax! The TO keyword must preceed the DO keyword.\n'
);
msg
=
sprinf
(
'
dseries::from:
Wrong syntax! The TO keyword must preceed the DO keyword.\n'
);
error
(
get_error_message_0
(
msg
))
end
if
~
isdate
(
varargin
{
1
})
msg
=
sprintf
(
'Wrong syntax! The FROM statement must be followed by a dates object.\n'
);
error
(
get_error_message_0
(
msg
))
% The first argument is not a string formatted date. Test if this argument refers to a dates object
% in the caller workspace.
try
d1
=
evalin
(
'caller'
,
varargin
{
1
});
if
~
isdates
(
d1
)
error
([
'dseries::from: Variable '
varargin
{
1
}
' is not a dates object!'
])
end
catch
error
([
'dseries::from: Variable '
varargin
{
1
}
' is unknown!'
])
end
if
~
exist
(
'd1'
)
msg
=
sprintf
(
'Wrong syntax! The FROM statement must be followed by a string formatted date.\n'
);
error
(
get_error_message_0
(
msg
))
end
else
d1
=
dates
(
varargin
{
1
});
% First date
end
if
~
isequal
(
to_id
,
2
)
msg
=
sprintf
(
'Wrong syntax! The first dates object must be immediately followed by the TO keyword.\n'
);
msg
=
sprintf
(
'
dseries::from:
Wrong syntax! The first dates object must be immediately followed by the TO keyword.\n'
);
error
(
get_error_message_0
(
msg
))
end
if
~
isdate
(
varargin
{
3
})
msg
=
sprintf
(
'Wrong syntax! The TO keyword must be followed by a second dates object.\n'
);
error
(
get_error_message_0
(
msg
))
% The third argument is not a string formatted date. Test if this argument refers to a dates object
% in the caller workspace.
try
d2
=
evalin
(
'caller'
,
varargin
{
3
});
if
~
isdates
(
d2
)
error
([
'dseries::from: Variable '
varargin
{
3
}
' is not a dates object!'
])
end
catch
error
([
'dseries::from: Variable '
varargin
{
3
}
' is unknown!'
])
end
if
~
exist
(
'd2'
)
msg
=
sprintf
(
'dseries::from: Wrong syntax! The TO keyword must be followed by a second dates object.\n'
);
error
(
get_error_message_0
(
msg
))
end
else
d2
=
dates
(
varargin
{
3
});
% Last date
end
d1
=
dates
(
varargin
{
1
});
% First date
d2
=
dates
(
varargin
{
3
});
% Last date
if
d1
>
d2
error
(
'The first date must preceed the second one!'
)
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment