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