csvread returns values divided by 1000

8 visualizaciones (últimos 30 días)
Andrew Cruce
Andrew Cruce el 11 de Dic. de 2016
Comentada: Star Strider el 11 de Dic. de 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?

Respuestas (1)

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

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by