csvread returns values divided by 1000
10 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
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 个评论
Star Strider
2016-12-11
Experiment with the format function.
Other possibilities are fprintf and sprintf with the appropriate format descriptors.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!