how to extract (x-y) coordinates after using the RECTANGLE function
Mostrar comentarios más antiguos
Hi,
I need to draw rectangles, given a center, an x_dimension and an y_dimension. I know that there is the specific function "rectangle" to do this, but in the programm I'm modifying it's mandatory to have the rectangles as sets of (x,y) coordinates ( so that plot(x,y) gives the desidered rectangle).
Is there a generic way to excract the coordinates from the rectangle function?
Respuestas (1)
Guillaume
el 1 de Mzo. de 2020
%r: [X, Y, width, height] description of a rectangle, that would be pass to rectangle with: rectangle('Position', r)
X = [r(1), r(1)+r(3), r(1)+r(3), r(1), r(1)];
Y = [r(2), r(2), r(2)+r(4), r(2)+r(4), r(2)];
plot(X, Y)
Categorías
Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!