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
613b3869
Verified
Commit
613b3869
authored
1 year ago
by
Willi Mutschler
Browse files
Options
Downloads
Patches
Plain Diff
irfmatching: add function to check for existence of irf_matching_file
parent
95bfb840
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!2191
IRF Matching
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/+mom/check_irf_matching_file.m
+57
-0
57 additions, 0 deletions
matlab/+mom/check_irf_matching_file.m
with
57 additions
and
0 deletions
matlab/+mom/check_irf_matching_file.m
0 → 100644
+
57
−
0
View file @
613b3869
function
[
irf_matching_file_name
,
irf_matching_file_path
]
=
check_irf_matching_file
(
irf_matching_file
)
% [irf_matching_file_name, irf_matching_file_path] = check_irf_matching_file(irf_matching_file)
% -------------------------------------------------------------------------
% Check if the provided irf_matching_file is a valid MATLAB function with
% .m extension and return name, path and extension of the file.
% -------------------------------------------------------------------------
% INPUTS
% - irf_matching_file: [string] user provided name (with possible path and extension)
% of the MATLAB function that transforms model irfs
% -------------------------------------------------------------------------
% OUTPUTS
% - irf_matching_file_name: [string] name of the MATLAB function (without extension)
% - irf_matching_file_path: [string] path to irf_matching_file_name
% -------------------------------------------------------------------------
% This function is called by
% - mom.run
% -------------------------------------------------------------------------
% Copyright © 2023 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
if
isempty
(
irf_matching_file
)
% no irf_matching_file provided, so no transformations will be done
irf_matching_file_name
=
''
;
irf_matching_file_path
=
''
;
else
[
irf_matching_file_path
,
irf_matching_file_name
,
irf_matching_file_ext
]
=
fileparts
(
irf_matching_file
);
% make sure file is a MATLAB function with .m extension
if
~
strcmp
(
irf_matching_file_ext
,
'.m'
)
if
strcmp
(
irf_matching_file_ext
,
''
)
irf_matching_file_ext
=
'.m'
;
else
error
(
'method_of_moments:
''
irf_matching_file
''
needs to point towards a MATLAB function with extension
''
.m
''
!'
);
end
end
if
isempty
(
irf_matching_file_path
)
irf_matching_file_path
=
'.'
;
end
if
exist
([
irf_matching_file_path
filesep
irf_matching_file_name
irf_matching_file_ext
],
'file'
)
~=
2
error
(
'method_of_moments: Could not find a
''
irf_matching_file
''
called
''
%s
''
!'
,[
irf_matching_file_path
filesep
irf_matching_file_name
irf_matching_file_ext
]);
end
end
\ No newline at end of file
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