tdfwrite (export data in Tab delimited format)

The structure returned by tdfread (Statistics tbx) can be stored with tdfwrite.
1,4K téléchargements
Mise à jour 22 oct. 2009

Afficher la licence

Matlab comes with a function called tdfread, which is one of the best functions for reading text files because it can handle numerical and textual data.
It reads textfiles with a header (to describe each column) and many rows of data. It surpasses Excel limitations with large number of rows.
tdfread creates a structure with as many fields as columns in the file, using column names as field names.

Unfortunately Matlab does not provide tdfwrite, so here it is.
It is as simple as tdfread and does exactly the opposite. It generates a textfile, creating a header with structure field names, then stores the data in textual format.

function tdfwrite(filename,st)

st is a structure created with st=tdfread('');
st is a structure with several fields. Each field is a vector of numbers or a matrix of char.

If the file is the following:
Latitude » Longitude » City
42.3584 » -71.0598 » Boston
40.4167 » -3.7003 » Madrid
41.8955 » 12.4823 » Rome

You can use
>> z=tdfread('');
>> tdfwrite('',z);

Then will look like this:
Latitude » Longitude » City
42.358400000000003 » -71.059799999999996 » Boston
40.416699999999999 » -3.7002999999999999 » Madrid
41.895499999999998 » 12.4823 » Rome

Citation pour cette source

Rafael Palacios (2024). tdfwrite (export data in Tab delimited format) (, MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2008a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
En savoir plus sur Migrate GUIDE Apps dans Help Center et MATLAB Answers

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

tdfread is not part of standard Matlab, it is only available with statistics toolbox.
tdfwrite works in any Matlab configuration

Corrected Tags in description