csvread returns values divided by 1000

1 visualizzazione (ultimi 30 giorni)
Andrew Cruce
Andrew Cruce il 11 Dic 2016
Commentato: Star Strider il 11 Dic 2016
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?

Risposte (1)

Star Strider
Star Strider il 11 Dic 2016
‘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 Commenti
Andrew Cruce
Andrew Cruce il 11 Dic 2016
Is there a way to get the values properly displayed in the matrix without the 1000 multiplication?
Star Strider
Star Strider il 11 Dic 2016
Experiment with the format function.
Other possibilities are fprintf and sprintf with the appropriate format descriptors.

Accedi per commentare.

Categorie

Scopri di più su Results, Reporting, and Test File Management in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by