guidata

Gets or sets user defined data in the GUI.

Syntax

R = guidata(handle)

guidata(handle, data)

Inputs

handle
Handle of the object associated with the guidata, R.
Type: double
data
User specified data. This will be stored in the handle, if handle is a figure. If handle is not a
figure, it will be stored in the figure associated with handle. If no data has been set, an empty matrix will be returned.
Type: [any]

Outputs

data
User specified data.
Type: [any]

Examples

guidata is used to set data:

f = figure;

frh = uicontrol('style','frame','string', 'Frame','position',[0.02 0.1 0.5 0.4],'units','normalized');
txh = uicontrol('parent',frh,'style','text','string', 'Text','position',[0.1 0.2 0.5 0.1],'units','normalized');
guidata(txh, rand(2,3))
guidata is used to set/get data:

f = figure;

frh = uicontrol('style','frame','string', 'Frame','position',[0.02 0.1 0.5 0.4],'units','normalized');
txh = uicontrol('parent',frh,'style','text','string', 'Text','position',[0.1 0.2 0.5 0.1],'units','normalized');
guidata(txh, 'teststring')

guidata(txh)
ans = teststring