How to select a rectangle on a graph?

Hi everyone :)
I cannot use the image processing toolbox function 'getrect' which lets you draw a rectangle on a graph and get its information (min X, min Y, width and length). I don't have the toolbox and it will take long time to get hold of it. I want to have this ability using standard Matlab only. How to do that?
Any help will be welcomed and appreciated, Alon

답변 (1개)

KSSV
KSSV 2016년 11월 6일

0 개 추천

doc imrect.

댓글 수: 4

Alon Rozen
Alon Rozen 2016년 11월 6일
Thanks KSSV, but 'imrect' is part of image processing toolbox which I can't use. I am trying to solve this without any toolbox.
KSSV
KSSV 2016년 11월 6일
Then go for ginput. doc ginput.
Alon Rozen
Alon Rozen 2016년 11월 7일
Thanks again, KSSV. Unfortunately, ginput requires to hold the execution until a respond is received. Also it is not a rectangle but a set of points. I need something which is similar to the way a preson use the + tool to enlarge part of the graph. Thanks anyway.
How about this?
clc; clear all ;
plot(rand(10,1))
rectangle('Position',[0.59,0.35,3.75,1.37],...
'LineWidth',2,'LineStyle','-')
You can change position, length and width.
Other option is. You can insert rectangle on the figure, go to insert > Rectangle. You can drag drop, adjust it's position, length and width. Then you can call ginput to get positions.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Data Exploration에 대해 자세히 알아보기

질문:

2016년 11월 6일

댓글:

2016년 11월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by