Configure multiple lines of same Line Properties in a single line?

1 回表示 (過去 30 日間)
Amanda Liu
Amanda Liu 2021 年 6 月 21 日
コメント済み: Amanda Liu 2021 年 6 月 24 日
Assume that I have 4 primitive lines with the same Line Properties, can I configure all 4 Line Properties in a single line so that I do not have to repeat typing their properties after each line?
line1 = line([0 5],[10 10],'linewidth',3,'color','r','linestyle',':');
line2 = line([0 5],[0 0],'linewidth',3,'color','r','linestyle',':');
line3 = line([0 0],[0 10],'linewidth',3,'color','r','linestyle',':');
line4 = line([5 5],[0 10],'linewidth',3,'color','r','linestyle',':');

採用された回答

Mohammad Sami
Mohammad Sami 2021 年 6 月 21 日
編集済み: Mohammad Sami 2021 年 6 月 21 日
I think the best you can do is as follows.
lines = line([0 0 0 5; 5 5 0 5],[10 0 0 0; 10 0 10 10],'linewidth',3,'color','r','linestyle',':')
lines =
4×1 Line array: Line Line Line Line
  4 件のコメント
Mohammad Sami
Mohammad Sami 2021 年 6 月 22 日
Also to add on, if you don't need the 4 lines separately and just need the square box, you can do it with a single line as well.
singleline = line([0 5 5 0 0],[0 0 10 10 0],'linewidth',3,'color','r','linestyle',':');
Amanda Liu
Amanda Liu 2021 年 6 月 24 日
Ohh, sry for replying late but thank you again!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by