Be the first to rate this file! 2 Downloads (last 30 days) File Size: 2.35 KB File ID: #39213
image thumbnail

printf

by Petter

 

27 Nov 2012 (Updated 30 Nov 2012)

Multiple file pointers. List printing features. Merged fprintf and sprintf.

| Watch this File

File Information
Description

A wrapper around fprintf and sprintf with the following features:
* Print to multiple file pointers.
* Append directly to files (given file name).
* Return the output as a string.
* Flexible support for printing lists.

Example:
>> s = printf({1,'foo.log'}, 'len(c)=%d, c=[%s].\n', length(c), {'%g', ' ', c});
len(c)=3, c=[3.14 1 15].
>> s2 = printf('<%s>', {[1 3 4 5]})

s2 =

<1, 3, 4, 5>

>>

Also append the printed text to file foo.log, and return it (incl the line break) to s.

Required Products MATLAB
MATLAB release MATLAB 7.13 (R2011b)
Tags for This File  
Everyone's Tags
format, fprintf, list, matrix, print, print printf list sprintf fprintf formatted, printf, sprintf, vector
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
28 Nov 2012

Just a change in the description.

Contact us