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

2 views (last 30 days)
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!

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!