Remove line between first and last point on plot
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
manateejoe
le 14 Juil 2015
Réponse apportée : manateejoe
le 14 Juil 2015
I am plotting data from a text file, however, the plot automatically connects the first and last points. How do I get rid of this line?

data = load('data.txt');
time = data(:,1);
avg = data(:,2);
plot(time, avg)
0 commentaires
Réponse acceptée
Plus de réponses (1)
Honglei Chen
le 14 Juil 2015
Are you sure your last point and first point are not the same? If they are, simply do
plot(time(1:end-1),avg(1:end-1))
2 commentaires
Star Strider
le 14 Juil 2015
See if:
time = [data(:,1); NaN];
avg = [data(:,2); NaN];
improves the plot.
If your data.txt file is not too large, attach it (use the ‘paperclip’ icon). Without it, it is only a guess as to what the best solution is.
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!