M-File Help: multidfprintf | View code for multidfprintf

# multidfprintf

Print formatted text to multiple streams

COUNT = MULTIDFPRINTF(IDVEC, FORMAT, A, ...) performs formatted output to multiple streams such as console and files. FORMAT is the format string as used by sprintf and fprintf. A is the array of elements, to which the format will be applied similar to sprintf and fprint.

IDVEC is a vector (1xN) of file descriptors and COUNT is a vector (1xN) of the number of bytes written to each file.

## Notes

- To write to the consolde use the file identifier 1.

## Example

    % Create and open a new example file:
    fid = fopen('exampleFile.txt','w+');
    % Write something to the file and the console simultaneously:
    multidfprintf([1 FID],'% s % d % d % d!\n','This is a test!',1,2,3);
    % Close the file:
    fclose(FID);

## Authors

Joern Malzahn 2012 RST, Technische Universitaet Dortmund, Germany. http://www.rst.e-technik.tu-dortmund.de

## See also

fprintf, sprintf

© 1990-2014 Peter Corke.