Length of a plotted line

5 views (last 30 days)
Hi, I have plots like this:
I want to know, how I can get the length of the lines in the x axis in the plot. Is there a function or can anyone write a code for me ?

Accepted Answer

Matt J
Matt J on 7 Jun 2022
Edited: Matt J on 7 Jun 2022
h=plot(2:6);
xlength = h.XData(end)-h.XData(1)
xlength = 4
  3 Comments
Frederik Reese
Frederik Reese on 7 Jun 2022
thanks for your great help.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!