writematrix as the recommended alternative to dlmwrite from R2019a
81 views (last 30 days)
Show older comments
Hello,
I recently moved to Excel 2016 and Matlab R2019a and saw a significant increase in the size of the csv written by dlmwrite.
I also saw that dlmwrite was not recomended starting from R2019a and the suggested alternative was writematrix.
writematrix does not offer all the flexibility of dlmwrite, such as row and columns offsets as well as precision.
Is there any workarounds to still be able to use row and columns offsets with writematrix ?
5 Comments
dpb
on 19 Aug 2019
I think Win7 vis a vis 10 had nothing to do with the symptoms and certainly as Guillaume notes Excel has nothing to do with dlmwrite and vice versa. I think the '100' as the precision argument had to be an accidental introduction that wasn't present in the compared-to cases when those files were created.
Accepted Answer
Guillaume
on 19 Aug 2019
The documentation of writematrix does say that it writes numbers using the longG fomat. longG format is 15 digits of precision (for double), which is about as much precision you can get from double numbers. Using more precision than that is pointless, and going to 100 is completely absurb as dpb said.
So. there's no point trying to be more precise than what writematrix does. If you want to be less precise, there's indeed no way to do that, so you'll have to use dlmwrite.
Similarly,if you want to write into an existing file, you'll also have to use dlmwrite.
For the typical use case, writematrix is a direct replacement. It doesn't mean you have to replace it.
Once again, for csv files, excel is completely irrelevant.
0 Comments
More Answers (0)
See Also
Categories
Find more on Text Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!