Csvwrite with numbers larger than 7 digits
Asked Answered
B

1

6

So, I have a file that's designed to parse through a rather large csv file to weed out a handful of data points. Three of the values (out of 400,000+) within the file is listed below:

Vehicle_ID  Frame_ID    Tot_Frames  Epoch_ms    Local_X
2           29          1707        1163033200  8.695
2           30          1707        1163033300  7.957
2           31          1707        1163033400  7.335

What I'm trying to do here is to take previously filtered data points like this and plug it into another csv file using csvwrite. However, csvread will only take in the Epoch_ms in double precision, storing the value as 1.1630e+09, which is sufficient for reading, as it does maintain the original value of the number for use in MATLAB operations.

However, during csvwrite, that precision is lost, and each data point is written as 1.1630e9.

How do I get csvwrite to handle the number with greater precision?

Bunsen answered 20/2, 2013 at 4:8 Comment(0)
R
12

Use dlmwrite with a precision argument, such as %i. The default delimiter is a comma, just like a CSV file.

dlmwrite(filename, data, 'precision', '%i')
Renita answered 20/2, 2013 at 4:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.