Matlab GUI zoom in/out

41 ビュー (過去 30 日間)
Trevor Harris
Trevor Harris 2013 年 3 月 15 日
コメント済み: Hassan Bosha 2019 年 2 月 16 日
Hey all,
Plot some data, go ahead, do it. You'll see that in the toolbar that there is a zoom "in" and zoom "out". Both yeild the curser to do two different things. I'm trying to program this function into a gui I'm making with my own zoom in and zoom out buttons. The zoom in works with the "zoom" function within the callback function, but I can't for the life of me figure out how to make the too do the opposite. Any suggestions? Thanks!
Trevor
  1 件のコメント
Hassan Bosha
Hassan Bosha 2019 年 2 月 16 日
What is the code for zooming in ?

サインインしてコメントする。

回答 (2 件)

Sean de Wolski
Sean de Wolski 2013 年 3 月 18 日
Are you using GUIDE?
If so, go to Tools -> Toolbar Editor and add the zoom in and zoom out buttons. There's no reason to reinvent the wheel.
As for doing it yourself, look at the doc for zoom() to see all of the things you can do. It's not as simple as just turning on zoom.
  1 件のコメント
A. Klomp
A. Klomp 2014 年 9 月 1 日
I know its a bit late but, as commented here, you can also turn back on the original toolbars:
set(h,'toolbar','figure');
set(h,'menubar','figure');

サインインしてコメントする。


Trevor Harris
Trevor Harris 2013 年 3 月 18 日
I'm doing this programmatically, and it's a fairly complex GUI. I'm making my own toolbar to be placed vertically on the left side of the GUI. Not only that, I only want 4 of the existing tools, and I'm adding a few of my own. So, I'm not reinventing the wheel, I'm putting on studded winter tires :-)
  1 件のコメント
Sean de Wolski
Sean de Wolski 2013 年 3 月 18 日
That is totally okay and encouraged!
It just means that you need to do a little bit more. Thus when you add the uitoggletool you have to specify how you want the zoom object to exist. I am too busy right now to make you an example but there is probably one out there.

サインインしてコメントする。

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by