Added the possibility to return the generated line in a variable.

time-shift
Stéphane Adjemian (Charybdis) 2015-02-26 16:10:44 +01:00
parent 04ae10434c
commit 4979f33f8b
1 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
function printline(n, s, fid)
function varargout = printline(n, s, fid)
% This function print a line formed by replicating a symbol s.
%
% INPUTS
@ -43,4 +43,8 @@ for i=2:n
S = sprintf('%s%s',S,s);
end
fprintf(f,sprintf('%s\n',S))
if nargout
varargout(1) = { sprintf('%s\n',S) };
else
fprintf(f,sprintf('%s\n',S))
end