Why are csvwrite and writetable producing different sized files?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 3 de Ag. de 2016
Respondida: MathWorks Support Team
el 22 de Ag. de 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.
Respuesta aceptada
MathWorks Support Team
el 3 de Ag. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Text Data Preparation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!