Skip to content
Snippets Groups Projects
Verified Commit ba6759f7 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

model settings: fix shocks_groups names

parent 19949774
No related branches found
No related tags found
No related merge requests found
......@@ -28,8 +28,7 @@ function status = gui_create_model_settings()
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global M_ ex0_ oo_
global project_info model_settings
global M_ ex0_ oo_ project_info model_settings
model_settings = struct();
......@@ -90,9 +89,9 @@ setappdata(0, 'model_settings', model_settings);
function create_shocks_cell_array()
if project_info.project_model_stochastic
model_settings.shocks = cell(M_.exo_nbr, 10);
else
model_settings.shocks = cell(M_.exo_nbr, 8);
else
model_settings.shocks = cell(M_.exo_nbr, 6);
end
model_settings.shocks(:, 1) = M_.exo_names;
model_settings.shocks(:, 2) = M_.exo_names_tex;
......@@ -105,7 +104,6 @@ setappdata(0, 'model_settings', model_settings);
model_settings.shocks(:, 6) = {''}; % STD
col = 7;
else
%TODO: check with Dynare team - how to display initval for deterministic case
if ~isempty(ex0_)
model_settings.shocks(:, 4) = num2cell(ex0_);
else
......@@ -113,9 +111,20 @@ setappdata(0, 'model_settings', model_settings);
end
col = 5;
end
model_settings.shocks(:, col) = {true};
model_settings.shocks(:, col+1) = {'All'};
model_settings.shocks(:, col+2) = {true};
model_settings.shocks(:, col+3) = {''};
if isfield(M_, 'shock_groups')
fn = fieldnames(M_.shock_groups);
for i = 1:length(fn)
gn = fieldnames(M_.shock_groups.(fn{i}));
for j = 1:length(gn)
sn = M_.shock_groups.(fn{i}).(gn{j}).shocks;
for k = 1:length(sn)
idx = find(not(cellfun('isempty', strfind(model_settings.shocks(:,1), sn{k}))));
model_settings.shocks{idx, col} = fn{i};
model_settings.shocks{idx, col+1} = M_.shock_groups.(fn{i}).(gn{j}).label;
end
end
end
end
end
end
......@@ -105,6 +105,44 @@ uicontrol(tabId, 'Style','pushbutton','String','Close this tab','Units','normali
ex0_(ii) = str2double(current_settings.shocks{ii,4});
end
end
% Doesn't support multiple shock groups for single shock.... needs new
% interface for that
% if isfield(M_, 'shock_groups')
% M_ = rmfield(M_, 'shock_groups');
% end
% for i = 1:rows(model_settings.shocks)
% if project_info.project_model_stochastic
% gn = model_settings.shocks{i, 7};
% sg = model_settings.shocks{i, 8};
% else
% gn = model_settings.shocks{i, 5};
% sg = model_settings.shocks{i, 6};
% end
% if ~isempty(gn) && ~isempty(sg)
% if ~isfield(M_, 'shock_groups')
% M_.shock_groups = struct;
% end
% if ~isfield(M_.shock_groups, gn)
% M_.shock_groups.(gn) = struct;
% end
% fn = fieldnames(M_.shock_groups.(gn));
% idx = length(fn) + 1;
% for j = 1:length(fn)
% if isfield(M_.shock_groups.(gn).(fn{j}), 'label')
% if strcmp(M_.shock_groups.(gn).(fn{j}).label, sg)
% idx = j;
% break;
% end
% end
% end
% M_.shock_groups.(gn).(['group' num2str(idx)]).label = sg;
% if isfield(M_.shock_groups.(gn).(['group' num2str(idx)]), 'shocks')
% M_.shock_groups.(gn).(['group' num2str(idx)]).shocks = [M_.shock_groups.(gn).(['group' num2str(idx)]).shocks model_settings.shocks(i, 1)];
% else
% M_.shock_groups.(gn).(['group' num2str(idx)]).shocks = model_settings.shocks(i, 1);
% end
% end
% end
for ii = 1:M_.param_nbr
M_.params(ii) = current_settings.params{ii,4};
......@@ -147,8 +185,8 @@ uicontrol(tabId, 'Style','pushbutton','String','Close this tab','Units','normali
end
end
column_names = {' Name ',' LaTeX name ', ' Long name ', ' Current value ', column_name, ' STD ', ' Show/Hide ', ' Group (tab) name ',' Show/Hide group ', ' Rename group '};
column_format = {'char','char','char','numeric' , 'numeric','numeric','logical', 'char','logical','char'};
column_names = {' Name ', ' LaTeX name ', ' Long name ', ' Current value ', column_name, ' STD ', ' Shock Groups ', ' Shock Group '};
column_format = {'char', 'char', 'char', 'numeric' , 'numeric', 'numeric', 'char', 'char'};
uit = uitable(tabId, ...
'Data', data, ...
'Units','normalized', ...
......@@ -191,8 +229,8 @@ uicontrol(tabId, 'Style','pushbutton','String','Close this tab','Units','normali
end
end
column_names = {' Name ',' LaTeX name ', ' Long name ', ' initval ', ' Show/Hide ', ' Group (tab) name ',' Show/Hide group ', ' Rename group '};
column_format = {'char','char','char','numeric' , 'logical', 'char','logical','char'};
column_names = {' Name ', ' LaTeX name ', ' Long name ', ' initval ', ' Shock Groups', ' Shock Group '};
column_format = {'char', 'char', 'char', 'numeric', 'char', 'char'};
uit = uitable(tabId, ...
'Data', data, ...
'Units', 'normalized', ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment