Matlab的:存储大量 [英] Matlab : Storing large numbers

查看:158
本文介绍了Matlab的:存储大量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的CSV文件看起来像这样

My csv file looks like this

'have', 1436271616097.0, 33.0, 'noChange', 1436271538982.0
'four', 1436271616130.0, 466.0, 'noChange', 1436271538982.0
'have', 1436271616596.0, 467.0, 'noChange', 1436271538982.0
'four', 1436271617063.0, 100.0, 'noChange', 1436271538982.0

我试着用 [NUM,TXT,生] = csvread('test.csv')
它显示了错误说太多的输出参数。

I tried using [num, txt, raw] = csvread('test.csv') it shows error saying Too many output arguments.

我尝试转换我的csv文件为原来的.xlsx但后来它改变了号码至此,

i tried converting my csv file to .xlsx but then it changes the numbers to this,

have    1.44E+12    33   noChange   1.44E+12
four    1.44E+12    466  noChange   1.44E+12
have    1.44E+12    467  noChange   1.44E+12
four    1.44E+12    100  noChange   1.44E+12
minutes 1.44E+12    666  noChange   1.44E+12

然后我用 [NUM,TXT,生] = xlsread('TEST.XLS')
但问题是,如果我显示 eyeT = VPA(eyeT(:,1))它显示了相同的浮点值。如何使用textscan这个?

then i used [num, txt, raw] = xlsread('test.xls') but the problem is that if i display eyeT = vpa(eyeT(:,1)) it shows same float value. how can i use textscan for this?

推荐答案

这与使用 textscan一个简单的例子对于所提到的CSV文件。这使您可以为每个列的单元格数组。

This as a short example using textscan for the mentioned csv-file. This gives you a cell array for each column.

% reading the data
file = fopen('file.csv');
F = textscan(file,'%s %f %f %s %f','Delimiter',',');

format long    % to show all the digits of the large number
celldisp(F)    % display the values of all cells

这是结果:

F{1}{1} =
'have'
F{1}{2} =
'four'
F{1}{3} =
'have'
F{1}{4} =
'four'
F{2} =
   1.0e+12 *
   1.436271616097000
   1.436271616130000
   1.436271616596000
   1.436271617063000
F{3} =
    33
   466
   467
   100
F{4}{1} =
'noChange'
F{4}{2} =
'noChange'
F{4}{3} =
'noChange'
F{4}{4} =
'noChange'
F{5} =
   1.0e+12 *
   1.436271538982000
   1.436271538982000
   1.436271538982000
   1.436271538982000

这篇关于Matlab的:存储大量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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