MATLAB: Remove line between first and last point on plot

plot

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)

Best Answer

I was able to figure it out: I had to sort my data:
[time, dum] = sort(time);
avg = avg(dum);
Related Question