Why are csvwrite and writetable producing different sized files?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 3 Août 2016
Réponse apportée : MathWorks Support Team
le 22 Août 2016
I have 200 tables in individual *.mat files with one table each (table values stored as double precision). I need to convert them to CSV to be read-in to R and tried out the two different methods:
1) writetable(, 'WriteVariableNames', false))
2) csvwrite(table2array())
The writetable output produces file sizes 25-90% larger than the similar csvwrite(table2array). Can you explain this behavior and why I should choose one method over the other?
The tables are approximately 4000x3500 in size so if there is significant differences between the two, I'd like to be aware of the differences in behavior.
Réponse acceptée
MathWorks Support Team
le 3 Août 2016
The discrepancy in file sizes appears to be the result of intended behavior of the "csvwrite" function. "csvwrite" only writes the first five significant digits of its matrix argument to file. "writetable" does not have this limitation. The result is that "csvwrite" produces files with significantly fewer characters in them than files produced by "writetable", and thus the files are significantly smaller.
For more information about the "csvwrite" function, you can follow the link below to our documentation:
http://www.mathworks.com/help/matlab/ref/csvwrite.html?searchHighlight=significant%20digits
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Text Data Preparation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!