How do you enable a user to maximize an axes on a matlab GUI?

조회 수: 2 (최근 30일)
Cordelle
Cordelle 2013년 6월 17일
Maximize a graph like you would maximize a windows application. I used guide to make the GUI.
thanks in advance,
Cordelle

답변 (2개)

Evan
Evan 2013년 6월 17일
편집: Evan 2013년 6월 17일
Do you mean you want the user to be able to set the axes to fill the GUI window? To do this, you could change the "Position" property of your axes. "Position" accepts four element vector arguments: [x y width height]. Whether this is in pixels, characters, or some other form depends on how you set the "Units" property.
So something like this:
set(axes_handle,'Position',[x y width height])
  댓글 수: 2
Cordelle
Cordelle 2013년 6월 17일
No, i would like the user to click some sort of maximize button, to make the graph fullscreen if needed
Evan
Evan 2013년 6월 17일
In that case, it would be a two-step process.
% create and get handles to axes and figure
f = figure;
a = axes;
% 1) make axes fill the figure
set(a,'Units','normalized')
set(a,'Position',[0 0 1 1])
% 2) make figure fill screen
set(f,'Units','normalized')
set(f,'Position',[0 0 1 1])
That's the crude way of doing it. You'll probably notice it seems to spill over a bit and is partially covered up by your taskbar and such. For a more accurate way (but still sloppy), first create a figure, then maximize it manually with the mousebutton, then type:
get(gcf,'Position')
Then copy and paste what you get into your code, being sure to set the figure units to 'pixels.'
Beyond that, I think there is a function on the file exchange that might let you maximize the figure in a bit more sophisticated way.

댓글을 달려면 로그인하십시오.


Jan
Jan 2013년 6월 17일
I still do not understand it exactly: Should the axes fill the figure or the screen? For the later the size of the figure must be maximized also.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by