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

4 次查看(过去 30 天)
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',':');

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by