Question about impositionrect value updates

The code below prints each time the position of the rectangle, but how can i also store that position in a variable?
close all, plot(1:10)
h = impositionrect(gca, [4 4 2 2]);
api = iptgetapi(h);
api.addNewPositionCallback(@(p) disp(p));
Thanks

4 Kommentare

Image Analyst
Image Analyst am 14 Jul. 2012
Why do you want that? Why are all the intermediate positions important to save rather than just the initial and final positions?
Raldi
Raldi am 15 Jul. 2012
i just saw you answer, i am sorry for not replying.
Image Analyst
Image Analyst am 15 Jul. 2012
Why are you not going to reply?
Raldi
Raldi am 15 Jul. 2012
No, i didn't mean it like that. I meant sorry for not replying till now.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 14 Jul. 2012

0 Stimmen

% if you want the latest position u can try this, will save 50 postions for exemple
close all, plot(1:10)
h = impositionrect(gca, [4 4 2 2]);
api = iptgetapi(h)
for k=1:50
n=api.addNewPositionCallback(@(m) disp(m));
pause
position(k,:)= api.getPosition
end
% this don't allow to save all postion, but allows to save a postion after evry pause (you have to press any key).

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Objects finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by