If the .Fig file contains an invisible figure, openfig returns its handle and leaves it invisible. The caller should make the figure visible when appropriate.
OPENFIG('NAME.FIG', 'reuse') opens figure contained in .fig file only if a copy is not currently open, otherwise ensures existing copy is still completely on screen. If the existing copy is visible, it is also raised above all other windows.
OPENFIG('NAME.FIG') is the same as OPENFIG('NAME.FIG', 'new').
F = OPENFIG(...) returns the handle to the figure.
See also: OPEN, MOVEGUI, GUIDE, GUIHANDLES, SAVE, SAVEAS.
UICONTROL Create user interface control.
UICONTROL('PropertyName1',value1,'PropertyName2,'value2,...)
creates a user interface control in the current figure window and returns a handle to it.
UICONTROL(FIG,...) creates a user interface control in the
specified figure.
UICONTROL properties can be set at object creation time using PropertyName/PropertyValue pair arguments to UICONTROL, or changed later using the SET command.
Execute GET(H) to see a list of UICONTROL object properties and their current values. Execute SET(H) to see a list of UICONTROL object properties and legal property values. See a reference guide for more information.
See also SET, GET, UIMENU.
UIMENU Create user interface menu.
UIMENU('PropertyName1',value1,'PropertyName2',value2,...) creates a menu on the menu bar at the top of the current figure window, and returns a handle to it.
UIMENU(H,...) creates a new menu with H as a parent. H must be a figure handle, menu handle, or context menu handle. If H is a figure handle, UIMENU creates a menu on the menu bar at the top of the window. If H is handle to a menu on the menu bar, the new menu is a menu item beneath the parent item on the menu bar. If H is a handle to a menu item, UIMENU creates a walking menu beneath the menu item. If H is a handle to a context menu, the new menu is a menu item on the context menu.
Menu properties can be set at object creation time using PropertyName/PropertyValue pair arguments to UIMENU, or changed later using the SET command.
Execute GET(H) to see a list of UIMENU object properties and their current values. Execute SET(H) to see a list of UIMENU object properties and legal property values. See a reference guide for more information.
See also SET, GET, UICONTROL, UICONTEXTMENU.
UICONTEXTMENU Create user interface context menu.
UICONTEXTMENU('PropertyName1',value1,'PropertyName2',value2,...)
creates a context menu and returns a handle to it. To attach a context menu to an object, set the object's UICONTEXTMENU property to the handle returned by the UICONTEXTMENU function.
Menu items can be added to the context menu using the UIMENU function.
Context menu properties can be set at object creation time using PropertyName/PropertyValue pair arguments to UICONTEXTMENU, or changed later using the SET command.
Execute GET(H) to see a list of UICONTEXTMENU object properties and their current values. Execute SET(H) to see a list of UICONTEXTMENU object properties and legal property values. See the reference guide for more information.
See also SET, GET, UIMENU.
GUIDATA Store or retrieve application data.
GUIDATA(H, DATA) stores the specified data in the figure's application data.
H is a handle that identifies the figure - it can be the figure itself, or any object contained in the figure.
DATA can be anything an application wishes to store for later retrieval.
DATA = GUIDATA(H) returns previously stored data, or an empty matrix if nothing was previously stored.
GUIDATA provides application authors with a convenient interface to a figure's application data. You can access the data from a callback subfunction using the component's handle, without needing to find the figure's handle. You can also avoid having to create and maintain a hardcoded property name for the application data throughout your source code. GUIDATA is particularly useful in conjunction with GUIHANDLES, which returns a structure containing handles of all the components in a GUI listed by tag.
Example:
Suppose an application creates a figure with handle F, containing a slider and an editable text uicontrol whose tags are 'valueSlider' and 'valueEdit' respectively. The following excerpts from the application's M-file illustrate the use of GUIDATA to access a structure containing handles returned by GUIHANDLES, plus additional application-specific data added during initialization and callbacks:
... excerpt from the GUI setup code ...
f = openfig('mygui.fig');
data = guihandles(f); % initialize it to contain handles
data.errorString = 'Total number of mistakes: ';
data.numberOfErrors = 0;
guidata(f, data); % store the structure
... excerpt from the slider's callback ...
data = guidata(gcbo); % get the struct, use the handles:
set(data.valueEdit, 'String',...
num2str(get(data.valueSlider, 'Value')));
... excerpt from the edit's callback ...
data = guidata(gcbo); % need handles, may need error info
val = str2double(get(data.valueEdit,'String'));
if isnumeric(val) & length(val)==1 & ...
val >= get(data.valueSlider, 'Min') & ...
val <= get(data.valueSlider, 'Max')
set(data.valueSlider, 'Value', val);
else
% increment the error count, and display it
data.numberOfErrors = data.numberOfErrors + 1;
set(handles.valueEdit, 'String',...
[ data.errorString, num2str(data.numberOfErrors) ]);
guidata(gcbo, data); % store the changes...
end
Note that GUIDE generates callback functions to which a structure of handles is passed automatically as an input argument. This eliminates the need to call "data = guidata(gcbo);" in callbacks written using GUIDE, unlike the example above.
See also GUIHANDLES, GUIDE, OPENFIG, GETAPPDATA, SETAPPDATA.
GETAPPDATA Get value of application-defined data.
VALUE = GETAPPDATA(H, NAME) gets the value of the application-defined data with name specified by NAME in the object with handle H. If the application-defined data does not exist, an empty matrix will be returned in VALUE.
VALUES = GETAPPDATA(H) returns all application-defined data for the object with handle H.
See also SETAPPDATA, RMAPPDATA, ISAPPDATA.
SETAPPDATA Set application-defined data.
SETAPPDATA(H, NAME, VALUE) sets application-defined data for the object with handle H. The application-defined data, which is created if it does not already exist, is assigned a NAME and a VALUE. VALUE may be anything.
See also GETAPPDATA, RMAPPDATA, ISAPPDATA.
GET Get object properties.
V = GET(H,'PropertyName') returns the value of the specified property for the graphics object with handle H. If H is a vector of handles, then get will return an M-by-1 cell array of values where M is equal to length(H). If 'PropertyName' is replaced by a 1-by-N or N-by-1 cell array of strings containing property names, then GET will return an M-by-N cell array of values.
GET(H) displays all property names and their current values for the graphics object with handle H.
V = GET(H) where H is a scalar, returns a structure where each field name is the name of a property of H and each field contains the value of that property.
V = GET(0, 'Factory')
V = GET(0, 'Factory<ObjectType>')
V = GET(0, 'Factory<ObjectType><PropertyName>')
returns for all object types the factory values of all properties which have user-settable default values.
V = GET(H, 'Default')
V = GET(H, 'Default<ObjectType>')
V = GET(H, 'Default<ObjectType><PropertyName>')
returns information about default property values (H must be scalar). 'Default' returns a list of all default property values currently set on H. 'Default<ObjectType>' returns only the defaults for properties of <ObjectType> set on H.
'Default<ObjectType><PropertyName>' returns the default value for the specific property, by searching the defaults set on H and its ancestors, until that default is found. If no default value for this property has been set on H or any ancestor of H up through the root, then the factory value for that property is returned.
Defaults can not be queried on a descendant of the object, or on the object itself - for example, a value for 'DefaultAxesColor' can not be queried on an axes or an axes child, but can be queried on a figure or on the root.
When using the 'Factory' or 'Default' GET, if PropertyName is omitted then the return value will take the form of a structure in which each field name is a property name and the corresponding value is the value of that property. If PropertyName is specified then a matrix or string value will be returned.
See also SET, RESET, DELETE, GCF, GCA, FIGURE, AXES.
Overloaded methods
help scribehgobj/get.m help scribehandle/get.m
help hgbin/get.m help framerect/get.m
help figobj/get.m help celltext/get.m
help cellline/get.m help axistext/get.m
help axisobj/get.m help axischild/get.m
help arrowline/get.m help serial/get.m
help avifile/get.m help activex/get.m
SET Set object properties.
SET(H,'PropertyName',PropertyValue) sets the value of the specified property for the graphics object with handle H.
H can be a vector of handles, in which case SET sets the properties' values for all the objects.
SET(H,a) where a is a structure whose field names are object property names, sets the properties named in each field name with the values contained in the structure.
SET(H,pn,pv) sets the named properties specified in the cell array of strings pn to the corresponding values in the cell array pv for all objects specified in H. The cell array pn must be 1-by-N, but the cell array pv can be M-by-N where M is equal to length(H) so that each object will be updated with a different set of values for the list of property names contained in pn.
SET(H,'PropertyName1',PropertyValue1,'PropertyName2',PropertyValue2,...) sets multiple property values with a single statement. Note that it is permissible to use property/value string pairs, structures, and property/value cell array pairs in the same call to SET.
A = SET(H, 'PropertyName')
SET(H,'PropertyName')
returns or displays the possible values for the specified property of the object with handle H. The returned array is a cell array of possible value strings or an empty cell array if the property does not have a finite set of possible string values.
A = SET(H)
SET(H)
returns or displays all property names and their possible values for the object with handle H. The return value is a structure whose field names are the property names of H, and whose values are cell arrays of possible property values or empty cell arrays.
The default value for an object property can be set on any of an object's ancestors by setting the PropertyName formed by concatenating the string 'Default', the object type, and the property name. For example, to set the default color of text objects to red in the current figure window:
set(gcf,'DefaultTextColor','red')
Defaults can not be set on a descendant of the object, or on the object itself - for example, a value for 'DefaultAxesColor' can not be set on an axes or an axes child, but can be set on a figure or on the root.
Three strings have special meaning for PropertyValues:
'default' - use default value (from nearest ancestor)
'factory' - use factory default value
'remove' - remove default value.
See also GET, RESET, DELETE, GCF, GCA, FIGURE, AXES.
Overloaded methods
help scribehgobj/set.m help scribehandle/set.m
help framerect/set.m help figobj/set.m
help editrect/set.m help editline/set.m
help celltext/set.m help cellline/set.m
help axistext/set.m help axisobj/set.m
help axischild/set.m help arrowline/set.m
help serial/set.m help avifile/set.m
help activex/set.m
GCBO Get handle to current callback object.
OBJECT = GCBO returns the handle of the object whose callback is currently executing. This handle is obtained from the root property 'CallbackObject'.
[OBJECT, FIGURE] = GCBO returns the handle of the object whose callback is currently executing, and the figure containing that object.
During a callback, GCBO can be used to obtain the handle of the object whose callback is executing, and the figure which contains that object. If one callback is interrupted by another, the root CallbackObject is updated to contain the handle of the object whose callback is interrupting. When the execution of the interrupting callback has completed, and the execution of the original callback resumes, the root CallbackObject is restored to contain the handle of the original object.
The root CallbackObject property is read-only, so its value is guaranteed to be valid at any time during a callback. The root CurrentFigure property, and the figure CurrentAxes and CurrentObject properties (returned by GCF, GCA, and GCO respectively) are user-settable, so they may change during the execution of a callback, especially if that callback is inter- rupted by another callback. As a result, those functions should not be considered interchangeable with GCBO, because they are not reliable indicators of which object's callback is executing.
When no callbacks are executing, GCBO returns [].
See also GCO, GCF, GCA, GCBF.
GCO Get handle to current object.
OBJECT = GCO returns the current object in the current figure.
OBJECT = GCO(FIG) returns the current object in the figure FIG.
The current object is the last object clicked on, excluding uimenus. If the click was not over a figure child, the figure itself will be the current object.
The handle of the current object is stored in the figure property CurrentObject, and can be accessed directly using GET and SET.
Use GCO in a callback to obtain the handle of the object that was clicked on. MATLAB updates the current object before executing each callback, so the current object may change if one callback is interrupted by another. To obtain the right handle during a callback, get the current object early, before any calls to DRAWNOW, WAITFOR, PAUSE, FIGURE, or GETFRAME which provide opportunities for other callbacks to interrupt.
