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

2 次查看(过去 30 天)
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!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by