annotate Problems/private/printf.m @ 10:207a6ae9a76f version1.0

(none)
author idamnjanovic
date Mon, 22 Mar 2010 15:06:25 +0000
parents
children
rev   line source
idamnjanovic@10 1 function str = printf(varargin)
idamnjanovic@10 2 %PRINTF Print formatted text to screen.
idamnjanovic@10 3 % PRINTF(FMT,VAL1,VAL2,...) formats the data in VAL1,VAL2,... according to
idamnjanovic@10 4 % the format string FMT, and prints the result to the screen.
idamnjanovic@10 5 %
idamnjanovic@10 6 % The call to PRINTF(FMT,VAL1,VAL2,...) simply invokes the call
idamnjanovic@10 7 % DISP(SPRINTF(FMT,VAL1,VAL2,...)). For a complete description of the
idamnjanovic@10 8 % format string options see function SPRINTF.
idamnjanovic@10 9 %
idamnjanovic@10 10 % STR = PRINTF(...) also returns the formatted string.
idamnjanovic@10 11
idamnjanovic@10 12
idamnjanovic@10 13 % Ron Rubinstein
idamnjanovic@10 14 % Computer Science Department
idamnjanovic@10 15 % Technion, Haifa 32000 Israel
idamnjanovic@10 16 % ronrubin@cs
idamnjanovic@10 17 %
idamnjanovic@10 18 % April 2008
idamnjanovic@10 19
idamnjanovic@10 20
idamnjanovic@10 21 if (nargout>0)
idamnjanovic@10 22 str = sprintf(varargin{:});
idamnjanovic@10 23 disp(str);
idamnjanovic@10 24 else
idamnjanovic@10 25 disp(sprintf(varargin{:}));
idamnjanovic@10 26 end