ginput question

7 次查看(过去 30 天)
vsee
vsee 2011-9-2
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

回答(1 个)

Grzegorz Knor
Grzegorz Knor 2011-9-2
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

类别

Help CenterFile Exchange 中查找有关 Visual Exploration 的更多信息

标签

尚未输入任何标签。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by