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