Filter löschen
Filter löschen

Length of a plotted line

10 Ansichten (letzte 30 Tage)
Frederik Reese
Frederik Reese am 7 Jun. 2022
Kommentiert: Frederik Reese am 7 Jun. 2022
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 ?

Akzeptierte Antwort

Matt J
Matt J am 7 Jun. 2022
Bearbeitet: Matt J am 7 Jun. 2022
h=plot(2:6);
xlength = h.XData(end)-h.XData(1)
xlength = 4
  3 Kommentare
Matt J
Matt J am 7 Jun. 2022
If you download the files from here, it's a simple modification
h=plot([2:4,nan,5:7]);
[start,stop]=groupLims(groupTrue(~isnan(h.YData)),1);
xLength=sum( h.XData(stop)-h.XData(start) )
xLength = 4
Frederik Reese
Frederik Reese am 7 Jun. 2022
thanks for your great help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by