Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Line Drawing Syntax Variations

2 Ansichten (letzte 30 Tage)
Jack
Jack am 8 Aug. 2014
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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!

Antworten (1)

Image Analyst
Image Analyst am 8 Aug. 2014
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