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 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!