csvread returns values divided by 1000
조회 수: 7 (최근 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!