Plot graph from Text data
조회 수: 1 (최근 30일)
이전 댓글 표시
Dear Sir,
I have Text data which part of data was shown below:
-197 -196 -187 -172 -174
-173 -157 -135 -112 -106
-106 -98 -100 -106 -107
-119 -122 -100 -86 -109
-122 -95 -80 -84 -75
-37 -20 -29 -16 4
23 33 44 67 80
100 113 103 107 128
138 126 116 112 98
76 50 44
-1 -23 -48 -76 -102
-121 -142 -159 -188 -221
-245 -274 -284 -291 -309
-305 -296 -312 -331 -320
-313 -322 -311 -288 -262
-252 -251 -237 -230 -229
-220 -209 -189 -170 -169
-177 -189 -188 -188 -194
-196 -207 -209 -205 -205
-206 -205 -210 -211 -189
-174 -172 -161 -155 -162
-169
-189 -183 -165 -143 -129
-120 -108 -84 -59 -42
-26 -4 28 54 71
96 121 137 131 118
120 123 131 128 100
71 64 63 49 38
The sampling rate of data was 20Hz that started at 00:00:00UT. But I don't know the end of time of sampling rate. Can you help me plot a graph from this data? The x axis should be time (UT) and y axis should be data as above. We should begin from the first row to the last row. Thank you very much.
Regards, Aike
댓글 수: 0
답변 (3개)
Fangjun Jiang
2011년 8월 22일
Take a look at the data again. There are blank spot in a few places. Are they supposed to be that way, or are they some type of line wrapping errors?
You can use importdata() to read the data. It fills NaN for those blank spots. It's also easy to tell how many rows are in the data using function size(data,1). Then, since the sample rate is fixed, it's pretty easy to generate the time stamps. You could do some extra to get the actual time, 00:00:01UT for example, instead of 1 second in the below example.
y=importdata('test.txt');
f=20;
ts=1/f;
x=ts*(1:size(y,1));
plot(x,y)
댓글 수: 0
shravankumar
2011년 8월 22일
hi,
you can also use y=dlmread('test.txt'). I think it takes the blank elements as zero and gives a continuous curve.
shravan.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!