- •Is constrained to the grid of size stepsize starting at the
- •If a mouse button is not down.
- •If Fixed is used for HorizontalAlignment or VerticalAlignment, then
- •It sets the figure properties that are recommended for dialog boxes.
- •In the base directory.
- •If isequal(filename,0) || isequal(pathname,0)
- •Itself, or any object contained in the figure.
- •Itself, or any object contained in the figure.
- •Instring is a cell array. Paragraph breaks are implemented for
- •Values. See the reference guide for detailed property information.
- •Information.
- •Information.
- •Information.
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 MATLAB code 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.
Reference page in Help browser
doc guidata
<guihandles> - Return a structure of handles.
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