Azzera filtri
Azzera filtri

Plot text file

3 visualizzazioni (ultimi 30 giorni)
Aike
Aike il 10 Set 2011
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 Commento
Rick Rosson
Rick Rosson il 10 Set 2011
Please format your code. If you do not know how, please click on the link called "Markup help" (below).

Accedi per commentare.

Risposte (1)

Rick Rosson
Rick Rosson il 10 Set 2011
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

Categorie

Scopri di più su Polar Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by