ginput question

14 vues (au cours des 30 derniers jours)
vsee
vsee le 2 Sep 2011
How do I control ginput execution. If I am panning through a large data plot, and if I want to zoom in on the plot and then use ginput to get x and y values. ginput seems to take into effect immediately as the plot appears on the screen and blocks zoom in and many other functions.
Thanks

Réponses (1)

Grzegorz Knor
Grzegorz Knor le 2 Sep 2011
One possibility:
% Display a file
I = imread('rice.png');
imshow(I);
zoom on; % use mouse button to zoom in or out
% Press Enter to get out of the zoom mode.
% CurrentCharacter contains the most recent key which was pressed after opening
% the figure, wait for the most recent key to become the return/enter key
waitfor(gcf,'CurrentCharacter',13)
zoom reset
zoom off
[c,r,but] = ginput(1)
from:
Other idea:
Write function call:
function call(src,evnt)
if double(evnt.Character)==103
ginput(1)
end
And then plot your data in this way:
figure('keypressfcn',@call);plot(1:10)
The 'g' key will activate ginput function. But first you have to unmark all positions from figure toolbar.
Grzegorz

Catégories

En savoir plus sur Visual Exploration dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by