Why are csvwrite and writetable producing different sized files?

1 Ansicht (letzte 30 Tage)
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.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 3 Aug. 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

Weitere Antworten (0)

Kategorien

Mehr zu Text Data Preparation finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by