|
"simon ott" <simon_ott@yahoo.com> wrote in message
news:gktfni$je$1@fred.mathworks.com...
>
> Hello,
> I want to declare global variables so that I could access them from my
> different GUI's. I declared then in OpeningFcn of every GUI.
>
> function Prog_OpeningFcn(hObject, eventdata, handles, varargin)
> global A
> global A
>
> but I still can not eccess them
> some hint please ?
If you declare a variable as global, then you must declare it as global in
EVERY function in which you want to access it via the global workspace.
That means that you will need to declare A as global in every callback
function that wants to use this variable in each of your GUIs. It also
means that if someone else's function uses A as a global variable then they
can potentially interfere with the operation of your GUI by changing A
without your GUI functions' knowledge. For these reasons and others, using
global variables is discouraged. Instead, you could store your data in the
handles structures for your GUIs (and give other GUI functions access to
those handles structures if they need access to the data in a particular
GUI), to store them in the UserData for your GUI, etc.
Look at these pages from the documentation for other techniques you can use
to share data between callbacks and between GUIs:
http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/brq3263.html
http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f5-1002439.html
--
Steve Lord
slord@mathworks.com
|