Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Line Drawing Syntax Variations

2 visualizaciones (últimos 30 días)
Jack
Jack el 8 de Ag. de 2014
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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!

Respuestas (1)

Image Analyst
Image Analyst el 8 de Ag. de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by