|
Hi again Heiko,
I think I figured out how to solve it. I will show how to
do it, maybe it could help some people.One way is using the
Userdata field. In the main file I wrote in the OpeningFcn,
after the guidata(hObject, handles) instruction:
set(0,'Userdata',handles);
%in this way we are using the 'Userdata' field of the root.
In the other file, I can recover the handles structure
doing the next:
p = get(0,'UserData');
So I have the handles structure stored in p, and I can
change any value, for example:
%change the "edit1" edit text of the GUI
set(p.edit1,'String','5');
In the case you have a subfunction (in other m.file) and
you want to pass the handles structure you can do:
function mySubFunction(hObject,Evendata,handles)
Then you can change the values of some objects pointed by
the handles, for example:
set(handles.edit1,'String','5');
guidata(hObject,handles); %I use this struction because if
not I have read the handles structure couldnt be uptadted.
The way of calling the function from the MAIN file (the
file in which you write your GUI) would be :
mySubfunction(hObject,[],handles);
So far I think I can modify some objects of the GUI from
other m.files (passing the handles structure). I know there
are other ways, but the two showed can suppose a solution.
Thanks again!
heiko_marx@hotmail.com wrote in message <5e8036c6-c668-4780-
927c-44993cfcee97@m44g2000hsc.googlegroups.com>...
> On 2 Sep., 10:38, "MRR " <mario_...@hotmail.com> wrote:
> > heiko_m...@hotmail.com wrote in message <bf67964c-728a-
4bdc-
> >
> > 92c6-b9361c8a4...@m45g2000hsb.googlegroups.com>...
> >
> >
> >
> > > On 2 Sep., 01:38, "MRR " <mario_...@hotmail.com>
wrote:
> > > > I have a GUI which has another figure wich contains
> > > > simulation parameters (time, parameters of a
model...).
> > > > This figure is opened when selected from a menu in
the
> > GUI.
> >
> > > > I want the GUI works in this way:
> >
> > > > 1- When you open the guy, it works load default
> > parameters.
> > > > 2- If you want to change this parameters, when
> > > > necessary,you open the figure with "simulation
> > > > parameters"(selected with a pushbutton), and change
them
> > > > with edit text objets.
> >
> > > > I think the best way for doing it would be sharing
the
> > > > handles structure, maybe loading default parameters
in
> > the
> > > > GUI and changing them when opening the "simulation
> > > > parameters" figure. I think a solution could be also
> > > > using "userdata" or "setappdata". Which is the best
way
> > for
> > > > doing it. Could anyone show me an example of what I
> > want to
> > > > do?
> >
> > > > Thanks in advance. MRR
> >
> > > Hi.
> >
> > > Did you try searching this group for your problem? It
has
> > been
> > > discussed a many hundred times before. Alternatively,
see
> > the
> > > documentation about dialogs.
> >
> > > Bye,Heiko
> >
> > Yes, I searched and I couldn?t find an example. Also I
saw
> > the documentation pdf of GUIDE. Anyway, I will continue
> > looking for a solution. Thanks for your answer.
>
> Hi again.
>
> What you want to do is have a "Edit Properties" dialog of
a more
> complex sort than the standard dialogs coming with MatLab
(like
> inputdlg). For a fast solution I can recommend "inpdlg"
(can be found
> in the MatLab File Exchange), where you can create
complex dialogs
> with different controls (edit boxes, check buttons,
etc.). Otherwise
> you have to build your own dialog GUI and use its
OutputFcn method.
> You can find examples in the documentation as well as
here, but
> because the complexity of this is strongly dependent on
what you want
> to do, you will end up creating your own design which
tends to be VERY
> different to everything else.
>
> Greetz,
> Heiko
|