Making looping plots interactive with zoom and pan

7 ビュー (過去 30 日間)
rmc256
rmc256 2014 年 11 月 20 日
編集済み: Chad Greene 2014 年 11 月 20 日
I have a set of data (2D space, 1D time), which I normally make movies out of.
I'd like to create a GUI in Matlab in which I can loop over the data in time, like a movie, but allow the user to interactively use the plotting tools (zoom, pan specifically) while the loop is still going. Perhaps also have a "pause" and "rewind/forward" slider bar.
It seems like someone would have already done this, but I'm not finding that functionality on the FEX.
If not, it seems like I can do this with capturing zoom and pan events, and a while loop doing the plotting. Does this seem feasible?

回答 (1 件)

Chad Greene
Chad Greene 2014 年 11 月 20 日
編集済み: Chad Greene 2014 年 11 月 20 日
Check out how Carlos Adrian Vargas Aguilera does it with ginput2.
There's a lot to decipher there, so perhaps you could do something like
if waitforbuttonpress % waitforbuttonpress is 1 if user hits any keyboard key
char = get(gcf, 'CurrentCharacter'); % char is the character number of pressed key
if char == 122 % 122 is the character number of lowercase z
lim = axis; % get current axis limits
pti=get(axes_handle, 'CurrentPoint'); % get current cursor point
% center axis limits on cursor point:
axis([pti(1,1)+diff(lim(1:2))/2*[-1 1] pti(1,2)+diff(lim(3:4))/2*[-1 1]]);
zoom(2) % zoom in
end
end

カテゴリ

Help Center および File ExchangeData Exploration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by