How can I connect the dots in my plot?
Show older comments
Basically if I plot it 'x' it looks fine but if I plot '--' the lines connect in crazy pattern. What can I do?


Its really annoying me. I know that I can sort the data to match up with the correct points but to be honest I'm not sure how to do that.
please find attached source files and data,
Accepted Answer
More Answers (1)
Walter Roberson
on 27 Aug 2016
[xs, xidx] = sort(x);
ys = y(xidx);
plot(xs, ys)
1 Comment
Dustin Braun
on 27 Aug 2016
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!