2015-02-26 16:10:44 +01:00
|
|
|
function varargout = printline(n, s, fid)
|
2015-02-18 18:31:39 +01:00
|
|
|
% This function print a line formed by replicating a symbol s.
|
|
|
|
%
|
2017-05-16 15:10:20 +02:00
|
|
|
% INPUTS
|
2015-02-18 18:31:39 +01:00
|
|
|
%
|
|
|
|
% n [integer] Length of the printed line
|
|
|
|
% s [char] Symbol used to draw the line (+, -, =, ...)
|
|
|
|
% f [integer] file id returned by fopen
|
2017-05-16 15:10:20 +02:00
|
|
|
%
|
|
|
|
% OUTPUTS
|
2015-02-18 18:31:39 +01:00
|
|
|
% None
|
|
|
|
|
2017-05-18 18:36:38 +02:00
|
|
|
% Copyright (C) 2015-2017 Dynare Team
|
2015-02-18 18:31:39 +01:00
|
|
|
%
|
|
|
|
% 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
|
2021-06-09 17:33:48 +02:00
|
|
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2015-02-18 18:31:39 +01:00
|
|
|
|
|
|
|
if nargin<3
|
|
|
|
f = 1;
|
|
|
|
if nargin<2
|
|
|
|
s = '-';
|
|
|
|
if ~nargin
|
|
|
|
error('printline: First argument is mandatory!')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
S = s;
|
|
|
|
|
|
|
|
for i=2:n
|
|
|
|
S = sprintf('%s%s',S,s);
|
|
|
|
end
|
|
|
|
|
2015-02-26 16:10:44 +01:00
|
|
|
if nargout
|
2015-02-26 16:18:33 +01:00
|
|
|
varargout(1) = { sprintf('%s',S) };
|
2015-02-26 16:10:44 +01:00
|
|
|
else
|
|
|
|
fprintf(f,sprintf('%s\n',S))
|
|
|
|
end
|