CSV file imported with readmatrix is misreading the data in the CSV file
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to read a roughly 400 row csvfile consisting of one column of 3 digit numbers and 35 colums of 8 digit integres. The resulting array consists of 5 digit numbers with a decimal point after the first number. This isn't too helpful. The numbers represent measured frequencies in the 15MHz range so I'm losing data when importing
0 comentarios
Respuestas (4)
per isakson
el 18 de Nov. de 2019
Editada: per isakson
el 18 de Nov. de 2019
"The resulting array consists of 5 digit numbers with a decimal point after the first number." I assume that you describe how the numbers are displayed in the Command Window.
Try
format long
Example:
>> format long
>> pi
ans =
3.141592653589793
>> format short
>> pi
ans =
3.1416
>>
"I'm losing data when importing" No, it's only a question of how the values are presented.
0 comentarios
James Andrada
el 18 de Nov. de 2019
1 comentario
per isakson
el 18 de Nov. de 2019
"is there any way to associate the format type with a variable" No
James Andrada
el 18 de Nov. de 2019
1 comentario
per isakson
el 18 de Nov. de 2019
Editada: per isakson
el 18 de Nov. de 2019
Example
>> fprintf( 1, '%.2f\n', pi )
3.14
>> fprintf( 1, '%.4f\n', pi )
3.1416
Ver también
Categorías
Más información sobre Text Files en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!