<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242606</link>
    <title>MATLAB Central Newsreader - declaring global variables: GUI'S</title>
    <description>Feed for thread: declaring global variables: GUI'S</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sat, 17 Jan 2009 20:40:18 -0500</pubDate>
      <title>declaring global variables: GUI'S</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242606#622285</link>
      <author>simon ott</author>
      <description>&lt;br&gt;
Hello,&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
function Prog_OpeningFcn(hObject, eventdata, handles, varargin)&lt;br&gt;
global A&lt;br&gt;
global A&lt;br&gt;
&lt;br&gt;
but I still can not eccess them &lt;br&gt;
some hint please ?&lt;br&gt;
&lt;br&gt;
simon</description>
    </item>
    <item>
      <pubDate>Sat, 17 Jan 2009 20:44:02 -0500</pubDate>
      <title>Re: declaring global variables: GUI'S</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242606#622286</link>
      <author>Sadik </author>
      <description>&quot;simon ott&quot; &amp;lt;simon_ott@yahoo.com&amp;gt; wrote in message &amp;lt;gktfni$je$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function Prog_OpeningFcn(hObject, eventdata, handles, varargin)&lt;br&gt;
&amp;gt; global A&lt;br&gt;
&amp;gt; global A&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; but I still can not eccess them &lt;br&gt;
&amp;gt; some hint please ?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; simon&lt;br&gt;
&lt;br&gt;
Hello Simon,&lt;br&gt;
&lt;br&gt;
I hope this helps [especially section 7]:&lt;br&gt;
&lt;br&gt;
Hello Cesar,&lt;br&gt;
&lt;br&gt;
I believe Section 7 of the following link is the one you are looking for:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/support/tech-notes/1200/1205.html&quot;&gt;http://www.mathworks.com/support/tech-notes/1200/1205.html&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Mon, 19 Jan 2009 15:52:41 -0500</pubDate>
      <title>Re: declaring global variables: GUI'S</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242606#622528</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;simon ott&quot; &amp;lt;simon_ott@yahoo.com&amp;gt; wrote in message &lt;br&gt;
news:gktfni$je$1@fred.mathworks.com...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt; I want to declare global variables so that I could access them from my &lt;br&gt;
&amp;gt; different GUI's. I declared then in OpeningFcn of every GUI.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; function Prog_OpeningFcn(hObject, eventdata, handles, varargin)&lt;br&gt;
&amp;gt; global A&lt;br&gt;
&amp;gt; global A&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; but I still can not eccess them&lt;br&gt;
&amp;gt; some hint please ?&lt;br&gt;
&lt;br&gt;
If you declare a variable as global, then you must declare it as global in &lt;br&gt;
EVERY function in which you want to access it via the global workspace. &lt;br&gt;
That means that you will need to declare A as global in every callback &lt;br&gt;
function that wants to use this variable in each of your GUIs.  It also &lt;br&gt;
means that if someone else's function uses A as a global variable then they &lt;br&gt;
can potentially interfere with the operation of your GUI by changing A &lt;br&gt;
without your GUI functions' knowledge.  For these reasons and others, using &lt;br&gt;
global variables is discouraged.  Instead, you could store your data in the &lt;br&gt;
handles structures for your GUIs (and give other GUI functions access to &lt;br&gt;
those handles structures if they need access to the data in a particular &lt;br&gt;
GUI), to store them in the UserData for your GUI, etc.&lt;br&gt;
&lt;br&gt;
Look at these pages from the documentation for other techniques you can use &lt;br&gt;
to share data between callbacks and between GUIs:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/brq3263.html&quot;&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/brq3263.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f5-1002439.html&quot;&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f5-1002439.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
  </channel>
</rss>

