How do you pass coordinates from getrect into a variable?
Mostrar comentarios más antiguos
So I've probably misunderstood this function altogether.
When using GetRect I am trying to return the coordinate and drag distances to a variable. When I do this in my script I can't get it to store the values, only output them to screen.
Simple script I used:
Selection = getrect;
Output I got:
Selection =
-9.6608 -4.0233 4.0111 3.3819
Everytime I seem to instantly lose the values. When I immediately try to access them after they don't exist.
Respuestas (2)
Image Analyst
el 25 de En. de 2016
0 votos
Step through your code a line at a time and figure out when Selection vanishes. You're possibly either doing a clear(), or losing scope. If it's the latter, see the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
2 comentarios
Dustin Gutsche
el 25 de En. de 2016
Image Analyst
el 26 de En. de 2016
Hard to replicate since I don't have your full code. If you want, you can use rbbox() or imrect() instead - they're essentially the same thing. But rbbox() "finishes" as soon as you lift the mouse button while imrect() lets you adjust the sides before "finishing".
Dustin Gutsche
el 25 de En. de 2016
0 votos
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!