Version 1.01 (10,3 ko) par per isakson
tprintf writes tabular data to a text file
91 téléchargements
Mise à jour 13 sept. 2017

Afficher la licence

tprintf provides an intuitive interface to fprintf for writing tabular data to a text
file. tprintf(filespec,format,A1,...,An) creates a tabular text file by writing the
columns of A1,...,An to columns in the text file.
fprintf(fid,format,v1,v2,...), where v1,v2,... are scalars, writes one row. To
print several rows one may put the function in a for-loop. That code is easy to read and
understand. However, with large files speed becomes a problem. fprintf(...,C{:}),
where C is a cell array containing numeric and character data, writes the text file much
faster. With pure numerical data fprintf(...,M), where M is matrix writes even faster.
However, the cell array, C, and the matrix, M, come at a price. It takes some effort to
create them and the resulting code is not all that easy to read and understand - IMO.
With tprintf I try to combined the best of the two.
Installation: This submission consists of three m-files and this documentation. Copy the
m-files to a folder on the Matlab search path. Verify that tprintf is working by running
>> tprintf( 1, '%d, %4.1f, %s, %s\n', [1;2], rand(2,1),{'first';'second'},['ABC';'DEF'] )
1, 0.6, first, ABC
2, 0.1, second, DEF
ans =

Citation pour cette source

per isakson (2024). tprintf (, MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2016a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version

fixed typo
lines added to "Overwiew"