Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Line Drawing Syntax Variations

2 ビュー (過去 30 日間)
Jack
Jack 2014 年 8 月 8 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi All,
Fairly new to matlab. I'm currently using NorthWall = [[0,30] 1 0]; to draw a horizontal line at y=30. Is there a way in this syntax to constrain that line so it only runs from say (0,30) to (20,30)? I know it's possible with other syntax line drawing methods such as NorthWall = line([0,30],[20,30]) but the library I am using requires they be drawn the first way. Is this possible or do I need to change my approach all together?
Thanks!

回答 (1 件)

Image Analyst
Image Analyst 2014 年 8 月 8 日
line([0,30],[20,30])
is the syntax I'm familiar with. You don't need to assign the graphics handle to NorthWall unless you want to, like for example if you wanted to delete that one specific line later.
NorthWall = [[0,30] 1 0];
is not really standard syntax (though it works) and does not draw a line or even define one. We don't know why your library requires that funny line of code. Do you have the function definition for it? For one thing [[0,30] 1 0] is just the same as [0, 30, 1, 0] - the internal extra set of brackets are unnecessary so I find it very hard to believe your "library" would require that. It will never know the difference. It will never know if you passed in [[0,30] 1 0] or [0, 30, 1, 0] since they evaluate to the same thing.

Community Treasure Hunt

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

Start Hunting!

Translated by