Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
36
Добавлен:
24.02.2016
Размер:
22.88 Кб
Скачать

GUIDE Design GUI.
GUIDE initiates the GUI Design Environment tools that allow
FIG-files to be edited interactively. Calling GUIDE by itself will
open a new untitled FIG-file. GUIDE(filename) opens the FIG-file
named 'filename' if it is on the MATLAB path. GUIDE(fullpath) opens
the FIG-file at 'fullpath' even if it is not on the MATLAB path.
GUIDE(HandleList) creates new FIG-files for each figure(s) containing
handles in the HandleList and copies the contents of the figure(s)
into the FIG-files.

See also INSPECT.


INSPECT Open the inspector and inspect object properties



%| ABOUT CALLBACKS:
%| GUIDE automatically appends subfunction prototypes to this file, and
%| sets objects' callback properties to call them through the FEVAL
%| switchyard above. This comment describes that mechanism.
%|
%| Each callback subfunction declaration has the following form:
%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)
%|
%| The subfunction name is composed using the object's Tag and the
%| callback type separated by '_', e.g. 'slider2_Callback',
%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
%|
%| H is the callback object's handle (obtained using GCBO).
%|
%| EVENTDATA is empty, but reserved for future use.
%|
%| HANDLES is a structure containing handles of components in GUI using
%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
%| structure is created at GUI startup using GUIHANDLES and stored in
%| the figure's application data using GUIDATA. A copy of the structure
%| is passed to each callback. You can store additional information in
%| this structure at GUI startup, and you can change the structure
%| during callbacks. Call guidata(h, handles) after changing your
%| copy to replace the stored original so that subsequent callbacks see
%| the updates. Type "help guihandles" and "help guidata" for more
%| information.
%|
%| VARARGIN contains any extra arguments you have passed to the
%| callback. Specify the extra arguments by editing the callback
%| property in the inspector. By default, GUIDE sets the property to:
%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))
%| Add any extra arguments after the last argument, before the final
%| closing parenthesis.




GUIHANDLES Return a structure of handles.
HANDLES = GUIHANDLES(H) returns a structure containing handles of
objects in a figure, using their tags as fieldnames. Objects
are excluded if their tags are empty, or are not legal variable
names. If several objects have the same tag, that field in the
structure contains a vector of handles. Objects with hidden
handles are included in the structure.

H is a handle that identifies the figure - it can be the figure
itself, or any object contained in the figure.

HANDLES = GUIHANDLES returns a structure of handles for the
current figure.

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 GUIHANDLES in callbacks:

... excerpt from the GUI setup code ...

f = figure;
uicontrol('Style','slider','Tag','valueSlider', ...);
uicontrol('Style','edit','Tag','valueEdit',...);

... excerpt from the slider's callback ...

handles = guihandles(gcbo); % generate handles struct
set(handles.valueEdit, 'string',...
num2str(get(handles.valueSlider, 'value')));

... excerpt from the edit's callback ...

handles = guihandles(gcbo);
val = str2double(get(handles.valueEdit,'String'));
if isnumeric(val) & length(val)==1 & ...
val >= get(handles.valueSlider, 'Min') & ...
val <= get(handles.valueSlider, 'Max')
% update the slider's value if the edit's value is OK:
set(handles.valueSlider, 'Value', val);
else
% flush the bad string out of the edit; replace with slider's
% current value:
set(handles.valueEdit, 'String',...
num2str(get(handles.valueSlider, 'Value')));
end

Note that in this example, the structure of handles is created
each time a callback executes. See the GUIDATA help for an
example in which the structure is created only once, and cached
for subsequent use.

See also GUIDATA, GUIDE, OPENFIG.



OPENFIG Open new copy or raise existing copy of saved figure.
OPENFIG('NAME.FIG', 'new') opens figure contained in .fig file,
NAME.FIG, and ensures it is completely on screen. Specifying the
.fig extension is optional. Specifying the full path is optional
as long as the .fig file is on the MATLAB path.

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.

If no figures exist, GCO returns [].

See also GCBO, GCF, GCA, GCBF.



GCF Get handle to current figure.
H = GCF returns the handle of the current figure. The current
figure is the window into which graphics commands like PLOT,
TITLE, SURF, etc. will draw.

The handle of the current figure is stored in the root
property CurrentFigure, and can be queried directly using GET,
and modified using FIGURE or SET.

Clicking on uimenus and uicontrols contained within a figure,
or clicking on the drawing area of a figure cause that
figure to become current.

The current figure is not necessarily the frontmost figure on
the screen.

GCF should not be relied upon during callbacks to obtain the
handle of the figure whose callback is executing - use GCBO
for that purpose.

See also FIGURE, CLOSE, CLF, GCA, GCBO, GCO, GCBF.


GCA Get handle to current axis.
H = GCA returns the handle to the current axis in the current
figure. The current axis is the axis that graphics commands
like PLOT, TITLE, SURF, etc. draw to if issued.
Use the commands AXES or SUBPLOT to change the current axis
to a different axis, or to create new ones.

See also AXES, SUBPLOT, DELETE, CLA, HOLD, GCF, GCBO, GCO, GCBF.


GCBF Get handle to current callback figure.
FIG = GCBF returns the handle of the figure that contains the
object whose callback is currently executing. If the current
callback object is the figure, the figure is returned.

When no callbacks are executing, GCBF returns [].

The return value of GCBF is identical to the FIGURE
output argument of GCBO.

See also GCBO, GCO, GCF, GCA.


CLA Clear current axis.
CLA deletes all children of the current axes with visible handles.

CLA RESET deletes all objects (including ones with hidden handles)
and also resets all axes properties, except Position and Units, to
their default values.

See also CLF, RESET, HOLD.


CLF Clear current figure.
CLF deletes all children of the current figure with visible handles.

CLF RESET deletes all children (including ones with hidden
handles) and also resets all figure properties, except Position
and Units, to their default values.

See also CLA, RESET, HOLD.


Соседние файлы в папке METOD