Csvwrite数字大于7位 [英] Csvwrite with numbers larger than 7 digits

查看:227
本文介绍了Csvwrite数字大于7位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有一个文件,旨在通过一个相当大的csv文件来解析一些数据点。文件中的三个值(超出400,000+)如下:

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

我想在这里做的是采取像这样的以前过滤的数据点,并使用csvwrite插入另一个csv文件。然而,csvread只接受双精度的Epoch_ms,将值存储为1.1630e + 09,这对于读取是足够的,因为它保持了用于MATLAB操作的数字的原始值。

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.

但是,在csvwrite期间,该精度丢失,每个数据点写为1.1630e9。

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

如何获取csvwrite

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

推荐答案

使用 dlmwrite ,带有精确参数,例如%i 。默认分隔符是逗号,就像CSV文件一样。

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')

这篇关于Csvwrite数字大于7位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆