Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Handles
Date: Wed, 10 Dec 2008 23:37:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <ghpjqu$7jn$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228952222 7799 172.30.248.38 (10 Dec 2008 23:37:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 10 Dec 2008 23:37:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1634745
Xref: news.mathworks.com comp.soft-sys.matlab:506233


Hi all,
I've been trying to learn about the 'handles' thing that appears in GUIDE scripts I've downloaded and in scripts I've downloaded from here. I just can't seem to get my head around it.
I have uploaded an example of my script where I haven't used this at all but it needs to be reviewed - I'll add the link when it becomes available.

However, in the meantime, an example of a function nested within my GUI is:
    m3=uicontrol(fig,...
        'style','pop');
    function calcbutton(source,eventdata); %push to calculate button
        str3=get(m3,'string');
        val3=get(m3,'value');
    end

I assume, using handles provides benifits which aren't apparent at the moment. Any advice on where to use this or where to research it would be greatly appreciated.

An example of the code I'm struggling to understand:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
saveState(handles)

I have read the help files on GUIDATA and GUIHANDLES but still don't understand it I'm afraid.

Cheers,
Chris