How can I draw a line with two points x1, y1 and x2, y2 and assign weight to the edge.

5 ビュー (過去 30 日間)
k khaja
k khaja 2022 年 3 月 10 日
コメント済み: k khaja 2022 年 3 月 10 日
How can I draw a line with two points (x1, y1) and (x2, y2) and assign weight to the edge.
Thanks in advance.
  4 件のコメント
KSSV
KSSV 2022 年 3 月 10 日
What do you mean by assigning weight?
k khaja
k khaja 2022 年 3 月 10 日
Like the above one assign weight 10 to line

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

回答 (1 件)

Scott MacKenzie
Scott MacKenzie 2022 年 3 月 10 日
編集済み: Scott MacKenzie 2022 年 3 月 10 日
x1 = 0; x2 = 1;
y1 = 0; y2 = 1;
line([x1 x2], [y1 y2], 'linewidth', 5);
text(0.45, 0.55, '10', 'FontSize', 14);
  3 件のコメント
Scott MacKenzie
Scott MacKenzie 2022 年 3 月 10 日
By "weight", it seems you mean a label. I just added this to the code.
k khaja
k khaja 2022 年 3 月 10 日
Thank you

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

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by