Plot text file
1 回表示 (過去 30 日間)
古いコメントを表示
I have a problem on plotting text data. I save it as .dat file. And then I use this code to plot data:
load tec.dat;
Time = tec(:,1)/3600;
Vtec = tec(:,2);
plot(Time,Vtec,'k');
My sampling y data is discontinuous. For example, the sampling time at 12000 second has y = 20.05. Then, the data skipped to the sampling time 57840 second that y = 6.14 (no data from 12000 - 57840 second). In fact, Matlab should not plot the y data between 12000 - 57840 second. However, Matlab also plots trend of the data from 12000 - 57840 second by itself as a linear line. How can I solve this problem?
1 件のコメント
Rick Rosson
2011 年 9 月 10 日
Please format your code. If you do not know how, please click on the link called "Markup help" (below).
回答 (1 件)
Rick Rosson
2011 年 9 月 10 日
There are several ways to do this.
One very easy method is to use the stem function instead of the plot function:
stem(Time,Vtec,'k');
Another method would be to insert the value NaN into the data vector at time steps where you have no valid data. You would also have to insert a corresponding time value (an actual number) in the time vector so that the time and data vectors would have the same size.
HTH.
Rick
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!