Mercurial > hg > smallbox
annotate Problems/private/printf.m @ 13:cd55209c69e1
(none)
author | idamnjanovic |
---|---|
date | Thu, 25 Mar 2010 14:02:09 +0000 |
parents | 207a6ae9a76f |
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 |