Skip to content
Snippets Groups Projects

load_m_file_data.m: pass structure instead of file

Merged Johannes Pfeifer requested to merge JohannesPfeifer/dseries:load_m_file into master
All threads resolved!
2 files
+ 16
9
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -16,7 +16,7 @@ function [freq, init, data, varlist, tex, ops, tags] = load_m_file_data(file) %
% be a scalar integer and INIT__ a string like '1938M11', '1945Q3', '1973W3' or '2009A'. If these variables are not specified
% default values for freq and init are 1 and dates(1,1).
% Copyright (C) 2012-2018 Dynare Team
% Copyright (C) 2012-2021 Dynare Team
%
% This file is part of Dynare.
%
@@ -45,14 +45,15 @@ if isoctave
clear argn;
end
save tmp__dataSet__.mat;
% the following aims at preventing horse-race conditions between writing the
% file and then immediately loading it, see https://git.dynare.org/Dynare/dseries/-/merge_requests/40
rehash;
% store variables to structure, workaround for https://git.dynare.org/Dynare/dseries/-/merge_requests/40
fields=[who].';
[freq, init, data, varlist, tex, ops, tags] = load_mat_file_data('tmp__dataSet__.mat');
assigns= cellfun(@(f) ['tmp__dataSet__struct.' f '=' f ';'],fields,'uniformoutput',0);
for line_iter=1:length(assigns)
eval(assigns{line_iter});
end
delete tmp__dataSet__.mat;
[freq, init, data, varlist, tex, ops, tags] = load_mat_file_data(tmp__dataSet__struct);
return
Loading