MATLAB Answers

How to select a rectangle on a graph?

5 views (last 30 days)
Alon Rozen
Alon Rozen on 6 Nov 2016
Commented: KSSV on 7 Nov 2016
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


Sign in to comment.

Answers (1)

KSSV on 6 Nov 2016
doc imrect.


Show 1 older comment
KSSV on 6 Nov 2016
Then go for ginput. doc ginput.
Alon Rozen
Alon Rozen on 7 Nov 2016
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.
KSSV on 7 Nov 2016
How about this?
clc; clear all ;
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!