I have a GUI which has several charts/graphs to display. But I would like to add an GUI object whose function is to minimize /maximize or restore the graph/plot within the GUI using a button. How can I do it? I have seen the list of GUI components, none of them are relevant to what I am looking for. Is it possible to import new functionality from other development environments like Microsoft .Net /Visual Studio or JAVA to MATLAB.
MATLAB: How to add minimize tool button in GUI
guiminimize object
Related Solutions
Changes in the behavior of the 'ResizeFcn' callback reflect changes to the positioning and layout of figures and containers to make their behavior more consistent with one another and across all platforms. Note that use of the 'ResizeFcn' property is not recommended. It might be removed in a future release. Use 'SizeChangedFcn' instead.
Starting in R2014b, the ResizeFcn callback might execute before all variables in the program file are assigned. When this happens, the 'ResizeFcn' callback returns an error.
For example, this GUI has a 'ResizeFcn' callback that uses a variable returned by the 'createGUI' function.
function mygui hs = createGUI; function handles = createGUI % Create figure and its children
f = figure('Tag','fig',... 'ResizeFcn',@doResizeFcn,... 'Visible','off'); u = uicontrol('Parent',f,'Tag','ctrl'); handles = guihandles(f); % make figure visible
set(f,'Visible','on'); end function doResizeFcn(varargin) length(hs) endendRunning this GUI in the new graphics system results in an error because 'hs' does not exist when the 'doResizeFcn' callback executes for the first time (when the figure becomes visible).myguiUndefined function or variable "hs".Error in mygui/doResizeFcn (line 18) length(hs) Error using mygui/createGUI (line 14)Error while evaluating Figure SizeChangedFcnTo correct the problem, make the figure visible after all the variables that the callback references are assigned. In this case, make the figure visible after calling the createGUI function.function mygui hs = createGUI; % Make the figure visible
set(hs.fig, 'Visible','on'); function handles = createGUI % Create figure and its children f = figure('Tag','fig',... 'ResizeFcn',@doResizeFcn,... 'Visible','off'); u = uicontrol('Parent',f,'Tag','ctrl'); handles = guihandles(f); end function doResizeFcn(varargin) length(hs) endend
Starting in R2014b, changing the size of an invisible container, such as a figure, panel, button group, does not trigger the ResizeFcn callback until the container becomes visible.
In previous releases of MATLAB®, the 'ResizeFcn' callback executes when the size of the container changes, regardless of whether it is visible.
You can control the visibility of figures and containers using the 'Visible' property:
- A figure is visible if its 'Visible' property is set to 'on'.
- A uipanel or uibuttongroup is visible if its 'Visible' property, and that of its ancestors, is set to 'on'. For example, a uibuttongroup whose parent is a uipanel is visible when the 'Visible' property of the uibuttongroup, uipanel, and the figure are all set to 'on'.
Starting in R2014b, changing the outer bounds of a figure or container does not trigger the 'ResizeFcn' callback.
For example, this figure 'ResizeFcn' callback does not execute in the new graphics system when you change the 'OuterPosition' (by removing the menu bar) on the second line of this code. However, the callback does execute in previous releases of MATLAB.
f = figure('ResizeFcn','display resized');set(f,'Menubar','none');Starting in R2014b, the 'ResizeFcn' callback executes only when the container's drawable area (the inner area) changes. Previous releases of MATLAB might not execute the 'ResizeFcn' callback when the drawable area changes.
For example, this uipanel 'ResizeFcn' callback executes in the new graphics system when you change the uipanel's drawable area by increasing the border width. The callback does not execute when your run this code in previous releases.
p = uipanel('ResizeFcn','display resized');set(p,'BorderWidth',3);
With App Designer you need to look at the Object's value property as you are doing. However, it will return a logical value. If it is depressed it will return 1 (true), else it will return 0 (false).
function StateButton_Pushed(app, eventdata) value = app.StateButton.Value; if value % I am considering this the pressed state
set(app.StateEditFieldLabel, 'Visible', 'on'); set(app.StateEditField, 'Visible','on'); elseif ~value % I am considering this the normal state
set(app.StateEditFieldLabel, 'Visible', 'off'); set(app.StateEditField, 'Visible','off'); endend
Related Question
- How to update a “child” figure
- Linking multiple GUI’s when moving the Main GUI
- How to hide/unhide button group using callbacks in Push button
- Creating App design control buttons programmically
- Do the UIControls inside the UIPanels flicker when the GUI first opens in MATLAB 7.7 (R2008b)
- How to invoke a function from within App Designer when using a DeleteFcn or CloseRequestFcn from a MATLAB figure that is separate from the App GUI
Best Answer