Length of a plotted line

11 ビュー (過去 30 日間)
Frederik Reese
Frederik Reese 2022 年 6 月 7 日
コメント済み: Frederik Reese 2022 年 6 月 7 日
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 ?

採用された回答

Matt J
Matt J 2022 年 6 月 7 日
編集済み: Matt J 2022 年 6 月 7 日
h=plot(2:6);
xlength = h.XData(end)-h.XData(1)
xlength = 4
  3 件のコメント
Matt J
Matt J 2022 年 6 月 7 日
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 2022 年 6 月 7 日
thanks for your great help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by