how do i set drawrectangle to have a specific increment only?

조회 수: 2 (최근 30일)
Adrian Lee
Adrian Lee 2020년 11월 4일
답변: Sylvain 2020년 11월 4일
I am trying to use drawrectangle
but what i want is the drawrectangle to have a specific increment ie: 0.5, 1.0...
but when i am using drawrectangle, after dragging to a different shape, the length, width, x coordinate and y coordinate will have some values such as
ROI moved current position: [3.50552486187845 3.89719626168224 5 5]
the values above are taken via a listener
instead of the above values, i want the values of the drawrectangle to be set as
ROI moved current position: [3.5 3.5 5 5] increments of 0.5
is that possible?
can it be done in the listener function?

답변 (1개)

Sylvain
Sylvain 2020년 11월 4일
you can set the property "Position" of an existing rectangle:
A=drawrectangle; %draw a rectangle
A.Position=[0.5 0.2 0.35 0.2] %modigy the position
Or you can set this property directly:
B= drawrectangle("Position",[3.5 3.5 5 5])
you can resize the axes to make it visible:
set(gca,"XLim",[0 6],"YLim",[0 6])

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by