ginput question

3 visualizzazioni (ultimi 30 giorni)
vsee
vsee il 2 Set 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

Risposte (1)

Grzegorz Knor
Grzegorz Knor il 2 Set 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

Categorie

Scopri di più su Data Exploration in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by