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

dynare.m: simplify code

parent 3a223e9c
Branches
Tags
No related merge requests found
......@@ -206,8 +206,9 @@ end
command = ['"' dynareroot 'preprocessor' arch_ext filesep 'dynare_m" ' fname] ;
command = [ command ' mexext=' mexext ' "matlabroot=' matlabroot '"'];
for i=1:length(varargin)
command = [command ' ' varargin{i}];
if ~isempty(varargin)
dynare_varargin = strjoin(varargin);
command = [command ' ' dynare_varargin];
end
if preprocessoroutput
......@@ -216,7 +217,7 @@ if preprocessoroutput
if isempty(varargin)
disp('none')
else
disp(strjoin(varargin));
disp(dynare_varargin);
end
end
......@@ -252,17 +253,11 @@ if exist(fname(1:end-4),'dir') && exist([fname(1:end-4) filesep 'hooks'],'dir')
end
% Save preprocessor result in logfile (if `no_log' option not present)
no_log = 0;
for i=1:length(varargin)
no_log = no_log || strcmp(varargin{i}, 'nolog');
end
fid = fopen(fname, 'r');
firstline = fgetl(fid);
fclose(fid);
if ~isempty(regexp(firstline, '//\s*--\+\s*options:(|.*\s|.*,)nolog(|\s.*|,.*)\+--'))
no_log = 1;
end
if ~no_log
if ~ismember('nolog', varargin) ...
&& isempty(regexp(firstline, '//\s*--\+\s*options:(|.*\s|.*,)nolog(|\s.*|,.*)\+--'))
logname = [fname(1:end-4) '.log'];
fid = fopen(logname, 'w');
fprintf(fid, '%s', result);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment