Thread Subject: Sharing data between Figures GUI

Subject: Sharing data between Figures GUI

From: MRR

Date: 1 Sep, 2008 23:38:02

Message: 1 of 5

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

Subject: Sharing data between Figures GUI

From: heiko_marx@hotmail.com

Date: 2 Sep, 2008 06:50:07

Message: 2 of 5

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

Subject: Sharing data between Figures GUI

From: MRR

Date: 2 Sep, 2008 08:38:02

Message: 3 of 5

heiko_marx@hotmail.com wrote in message <bf67964c-728a-4bdc-
92c6-b9361c8a4be9@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.

Subject: Sharing data between Figures GUI

From: heiko_marx@hotmail.com

Date: 3 Sep, 2008 07:33:15

Message: 4 of 5

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

Subject: Sharing data between Figures GUI

From: MRR

Date: 3 Sep, 2008 08:25:03

Message: 5 of 5

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

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gui MRR 3 Sep, 2008 04:30:22
sharing data MRR 3 Sep, 2008 04:30:22
handles MRR 3 Sep, 2008 04:30:22
rssFeed for this Thread

Contact us at files@mathworks.com