forked from AEADataEditor/replication-template-development
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate-config.m
77 lines (62 loc) · 1.95 KB
/
template-config.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%%% This template file should be copied to the root of the Matlab
%%% codes of the author, and renamed to "config.m"
%%%
%%% This sets the directory structure type
%%% /* Structure of the code, two scenarios:
%%% - Code looks like this (simplified, Scenario A)
%%% directory/
%%% code/
%%% main.m
%%% 01_dosomething.m
%%% data/
%%% data.dta
%%% otherdata.dta
%%% - Code looks like this (simplified, Scenario B)
%%% directory/
%%% main.m
%%% scripts/
%%% 01_dosomething.m
%%% data/
%%% data.dta
%%% otherdata.dta
%%% For the variable "scenario" below, choose "A" or "B". It defaults to "B", since this seems to be more common for Matlab jobs
%%%
%%% NOTE: you should always put "config.m" in the same directory as "main.m"
%%% */
scenario = "B"
%%% this dynamically captures the rootdir
[mydir, thisFileName, ~ ] = fileparts(mfilename('fullpath'))
if ~exist('configdone','var')
% do initial config
if scenario == "A"
cd ..
rootdir = pwd
cd(mydir)
else
rootdir = mydir
end
configdone = 'TRUE'
end
%%% This captures the version of Matlab and its installed toolboxes.
ver
%%% Any mention elsewhere of hard-coded paths should now be replaced by fullfile(rootdir,'name of file')
% datadir = "../../empirics"
% becomes
% datadir = fullfile(rootdir,"data")
% Special case:
% results = "../results"
% results = "/results" %% if running on Codeocean
%%% Dynare settings
%
% The following are possible Dynare settings. Uncomment the one you need.
% dynarepath = "/Applications/Dynare/4.6.1/matlab"
% dynarepath = "S:\LDILab\dynare\dynare-4.5.7\matlab"
%dynarepath = "L:\common\dynare-4.5.7\matlab"
%
% Then uncomment the following line:
%
%addpath(genpath(dynarepath))
%
% display the search path
%
path