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

18 vues (au cours des 30 derniers jours)
k khaja
k khaja le 10 Mar 2022
Commenté : k khaja le 10 Mar 2022
How can I draw a line with two points (x1, y1) and (x2, y2) and assign weight to the edge.
Thanks in advance.
  4 commentaires
KSSV
KSSV le 10 Mar 2022
What do you mean by assigning weight?
k khaja
k khaja le 10 Mar 2022
Like the above one assign weight 10 to line

Connectez-vous pour commenter.

Réponses (1)

Scott MacKenzie
Scott MacKenzie le 10 Mar 2022
Modifié(e) : Scott MacKenzie le 10 Mar 2022
x1 = 0; x2 = 1;
y1 = 0; y2 = 1;
line([x1 x2], [y1 y2], 'linewidth', 5);
text(0.45, 0.55, '10', 'FontSize', 14);
  3 commentaires
Scott MacKenzie
Scott MacKenzie le 10 Mar 2022
By "weight", it seems you mean a label. I just added this to the code.

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by