Why are csvwrite and writetable producing different sized files?
1 回表示 (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2016 年 8 月 3 日
回答済み: MathWorks Support Team
2016 年 8 月 22 日
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.
採用された回答
MathWorks Support Team
2016 年 8 月 3 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Text Data Preparation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!