How to use getrect only for axes1?

2 ビュー (過去 30 日間)
guanin hae
guanin hae 2022 年 1 月 2 日
コメント済み: guanin hae 2022 年 1 月 3 日
I would like to show an image on GUI, and get the selected regions positions with getrect. But when i run my code i can draw a rectangle anywhere on the figure, but i want getrect to work only on axes1. How can i do that?
[file,path] = uigetfile('*.png');
if isequal(file,0)
disp('User selected Cancel');
disp(['User selected ', fullfile(path,file)]);
rect = getrect;
x1 =rect(1);
x2 = x1 + rect(3);
y1 =rect(2);
y2 = y1 + rect(4);


Adam Danz
Adam Danz 2022 年 1 月 2 日
Specify the axis handle in the first input
However, getrect is outdated. Consider using
  4 件のコメント
guanin hae
guanin hae 2022 年 1 月 3 日
It worked thank you!


その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by