Connecting a line from the first data point to the last data point

12 views (last 30 days)
I have a 2D scatter plot. I am trying to create a line that connects from the very first data point to the very last data point only. I would appreciate any help. I have a total of 40 data points.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 10 Jul 2020
x=1:10;
y=rand(size(x));
scatter(x,y);
line(x([1 end]),y([1,end]))

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!