csvread without decimal point

5 ビュー (過去 30 日間)
Sepp
Sepp 2014 年 10 月 19 日
回答済み: Sepp 2014 年 10 月 20 日
Hi
I have a text file which has data of the following format:
17,1413736800061,4,2
17,1413736800153,12,0
17,1413736800239,6,2
17,1413736800324,5,1
17,1413736800410,6,1
17,1413736800496,6,1
.....
.....
Now, when I read in the file with M = csvread(fileName); and then I print the matrix M in Matlab I get values like the following (the values do not correspond to the ones above).
0.000000000017000 1.413737868957000 0.000000000003000 0
0.000000000017000 1.413737869045000 0.000000000008000 0.000000000002000
0.000000000017000 1.413737869128000 0.000000000003000 0
0.000000000017000 1.413737869211000 0.000000000003000 0.000000000002000
0.000000000017000 1.413737869294000 0.000000000003000 0
0.000000000017000 1.413737869376000 0.000000000002000 0.000000000002000
0.000000000017000 1.413737869460000 0.000000000003000 0
0.000000000017000 1.413737869550000 0.000000000010000 0.000000000002000
0.000000000017000 1.413737869634000 0.000000000004000 0
How can I get just normal vlues without a decimal point?

採用された回答

dpb
dpb 2014 年 10 月 19 日
But it is the input data...you're ignoring the scale factor Matlab uses when display disparate values on the command window...
>> type sepp.csv
17,1413736800061,4,2
17,1413736800153,12,0
17,1413736800239,6,2
17,1413736800324,5,1
17,1413736800410,6,1
17,1413736800496,6,1
>> csvread('sepp.csv')
ans =
1.0e+12 *
0.0000 1.4137 0.0000 0.0000
0.0000 1.4137 0.0000 0
0.0000 1.4137 0.0000 0.0000
0.0000 1.4137 0.0000 0.0000
0.0000 1.4137 0.0000 0.0000
0.0000 1.4137 0.0000 0.0000
>> [ans(:,1) ans(:,3)]
ans =
17 4
17 12
17 6
17 5
17 6
17 6
>>
NB: the 1.0e+12 * in the beginning of the array after reading the file; it's significant.
To see the values are really there, then displayed the first and third columns so the scaling is unity.

その他の回答 (1 件)

Sepp
Sepp 2014 年 10 月 20 日
Thank you very much. It's my fault, I didn't see the scaling factor because I have such an enormous amount of data.

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by