How to control the precison of a table that has varying number of columns in writetable?

4 vues (au cours des 30 derniers jours)
Leon
Leon le 20 Oct 2019
Modifié(e) : Leon le 20 Oct 2019
This is my table:
T1 = table(A, EXP, CRU, STA, CAS, NIS, SAM, ... );
If the # of columns is set, I would be able to specify the precision of each column as something like this:
formatSpec = '%s %d %2.1f %s %10.4f %8.3f\n';
and then use the below command to write the table to a txt file:
writetable(T1, 'Table1.txt', formatSpec, 'delimiter','\t');
The problem is that my table can have varying number of columns. If a column only contains NaNs, it will be dropped using the below command, for example:
T1.EXP = [];
In this case, how should I specify the formatSpec?
Many thanks!

Réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by