From: Adam on
Hi again,

I am trying to pass data back and forth from a GUIDE Gui (gui.m) to another .m function (let's call it function.m). To pass data from gui.m to function.m i'm using handles as a parameter-that is, I call it as function(handles). I can also update the Gui from the function by doing something like:

set(handles.edit,'string', 5)
guidata(gcbf,handles)

Now I'm trying to add stuff from function.m to the handles so that it can be read by gui.m. For example:

handles.newvariable=5
guidata(gcbf,handles)

This results in a new field within function.m. However, when I check the handles from within the gui.m file the field is not there, since gui's handles weren't changed. So, what I'm looking for is a way to update the gui.m handles from function.m or have a way to read function.m's handles from within gui.m. Since it is a GUIDE gui I don't what the handle for gui.m is.

Thanks a lot,
Adam
From: Walter Roberson on
Adam wrote:
> Hi again,
>
> I am trying to pass data back and forth from a GUIDE Gui (gui.m) to
> another .m function (let's call it function.m). To pass data from gui.m
> to function.m i'm using handles as a parameter-that is, I call it as
> function(handles). I can also update the Gui from the function by doing
> something like:
>
> set(handles.edit,'string', 5)
> guidata(gcbf,handles)
>
> Now I'm trying to add stuff from function.m to the handles so that it
> can be read by gui.m. For example:
>
> handles.newvariable=5
> guidata(gcbf,handles)
>
> This results in a new field within function.m. However, when I check the
> handles from within the gui.m file the field is not there, since gui's
> handles weren't changed. So, what I'm looking for is a way to update the
> gui.m handles from function.m or have a way to read function.m's handles
> from within gui.m. Since it is a GUIDE gui I don't what the handle for
> gui.m is.

Inside gui.m, are you re-executing

handles = guidata(gcf);

?

If not, then although the gui data would have changed, the gui would not
know about the change (at least not in that routine.)