csvread returns values divided by 1000

8 ビュー (過去 30 日間)
Andrew Cruce
Andrew Cruce 2016 年 12 月 11 日
コメント済み: Star Strider 2016 年 12 月 11 日
I am trying to load the following elements contained in a file into an array using csvread:
6000,-0.7432,-0.3915,0.1419,0.0000,0.0000,3,9,8,233
6100,-0.7432,-0.3915,0.1419,0.0000,0.0000,3,9,8,233
6200,-0.7432,-0.3915,0.1419,0.0000,0.0000,3,9,8,233
6300,-0.7432,-0.3915,0.1419,0.0000,0.0000,3,9,8,233
When I do the csvread I get the following result:
m = csvread('c:\gps test output\matlab1.gps')
m =
1.0e+03 *
Columns 1 through 6
6.0000 -0.0007 -0.0004 0.0001 0 0
6.1000 -0.0007 -0.0004 0.0001 0 0
6.2000 -0.0007 -0.0004 0.0001 0 0
6.3000 -0.0007 -0.0004 0.0001 0 0
Columns 7 through 10
0.0030 0.0090 0.0080 0.2330
0.0030 0.0090 0.0080 0.2330
0.0030 0.0090 0.0080 0.2330
0.0030 0.0090 0.0080 0.2330
Why is there a 1.0e+03 * at the beginning of the output and why aren't the values in the file properly loaded into the matrix m?

回答 (1 件)

Star Strider
Star Strider 2016 年 12 月 11 日
‘Why is there a 1.0e+03 * at the beginning of the output and why aren't the values in the file properly loaded into the matrix m?’
The ‘1e+03’ means that all the elements in the entire matrix is multiplied by 1000 from the way they are displayed. The values in matrix ‘m’ have been imported and exist correctly.
  2 件のコメント
Andrew Cruce
Andrew Cruce 2016 年 12 月 11 日
Is there a way to get the values properly displayed in the matrix without the 1000 multiplication?
Star Strider
Star Strider 2016 年 12 月 11 日
Experiment with the format function.
Other possibilities are fprintf and sprintf with the appropriate format descriptors.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by