<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167254</link>
    <title>MATLAB Central Newsreader - grouping plot handles?</title>
    <description>Feed for thread: grouping plot handles?</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>Wed, 09 Apr 2008 14:08:02 -0400</pubDate>
      <title>grouping plot handles?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167254#425644</link>
      <author>David Doria</author>
      <description>I would like to do this&lt;br&gt;
%group 1&lt;br&gt;
a=plot(0,1,'o');&lt;br&gt;
b=plot(1,1,'ro');&lt;br&gt;
&lt;br&gt;
%group 2&lt;br&gt;
c=plot(1,2,'go');&lt;br&gt;
&lt;br&gt;
delete(group 1)&lt;br&gt;
&lt;br&gt;
how would I do that?&lt;br&gt;
&lt;br&gt;
Thanks&lt;br&gt;
&lt;br&gt;
Dave</description>
    </item>
    <item>
      <pubDate>Wed, 09 Apr 2008 14:48:03 -0400</pubDate>
      <title>Re: grouping plot handles?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167254#425650</link>
      <author>helper </author>
      <description>&quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;ftiik2$7ni$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I would like to do this&lt;br&gt;
&amp;gt; %group 1&lt;br&gt;
&amp;gt; a=plot(0,1,'o');&lt;br&gt;
&amp;gt; b=plot(1,1,'ro');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %group 2&lt;br&gt;
&amp;gt; c=plot(1,2,'go');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; delete(group 1)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; how would I do that?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Dave&lt;br&gt;
&lt;br&gt;
Try this:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;%group 1&lt;br&gt;
group{1}(1) = plot(0,1,'o');&lt;br&gt;
group{1}(2) = plot(1,1,'ro');&lt;br&gt;
&amp;nbsp;&lt;br&gt;
%group 2&lt;br&gt;
group{2}(1) = plot(1,2,'go');&lt;br&gt;
&amp;nbsp;&lt;br&gt;
delete(group{1})&lt;br&gt;
&lt;br&gt;
You could used &quot;group1&quot; and &quot;group2&quot; in place of &quot;group{1}&quot; &lt;br&gt;
and &quot;group{2}&quot;.  However, I placed each group into a &lt;br&gt;
different cell of a cell array so it will be easy for you &lt;br&gt;
to create (for example) group{142} if you need to.</description>
    </item>
    <item>
      <pubDate>Wed, 09 Apr 2008 15:38:02 -0400</pubDate>
      <title>Re: grouping plot handles?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167254#425663</link>
      <author>David Doria</author>
      <description>ah cool , i didn't realize you could delete an array of&lt;br&gt;
function handles.&lt;br&gt;
&lt;br&gt;
Heres another problem i'm having:&lt;br&gt;
in a for loop, i have this statement:&lt;br&gt;
&lt;br&gt;
	if ismember('hNewCam', who) == 1&lt;br&gt;
		delete(hNewCam);&lt;br&gt;
	end&lt;br&gt;
&lt;br&gt;
which is just to prevent the handle from being delete the&lt;br&gt;
first time through the loop (since it doesn't exist yet). &lt;br&gt;
The thing is, I get this error:&lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt; delete&lt;br&gt;
Invalid handle object.&lt;br&gt;
&lt;br&gt;
but if I put a breakpoint at the beginning of the loop and&lt;br&gt;
delete(hNewCam) manually, it works fine!!??&lt;br&gt;
&lt;br&gt;
any thoughts?&lt;br&gt;
&lt;br&gt;
David&lt;br&gt;
&quot;helper &quot; &amp;lt;spamless@nospam.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;ftikv3$h37$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;ftiik2$7ni$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I would like to do this&lt;br&gt;
&amp;gt; &amp;gt; %group 1&lt;br&gt;
&amp;gt; &amp;gt; a=plot(0,1,'o');&lt;br&gt;
&amp;gt; &amp;gt; b=plot(1,1,'ro');&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; %group 2&lt;br&gt;
&amp;gt; &amp;gt; c=plot(1,2,'go');&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; delete(group 1)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; how would I do that?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Dave&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Try this:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  %group 1&lt;br&gt;
&amp;gt; group{1}(1) = plot(0,1,'o');&lt;br&gt;
&amp;gt; group{1}(2) = plot(1,1,'ro');&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; %group 2&lt;br&gt;
&amp;gt; group{2}(1) = plot(1,2,'go');&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; delete(group{1})&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You could used &quot;group1&quot; and &quot;group2&quot; in place of &quot;group{1}&quot; &lt;br&gt;
&amp;gt; and &quot;group{2}&quot;.  However, I placed each group into a &lt;br&gt;
&amp;gt; different cell of a cell array so it will be easy for you &lt;br&gt;
&amp;gt; to create (for example) group{142} if you need to.</description>
    </item>
    <item>
      <pubDate>Wed, 09 Apr 2008 15:50:19 -0400</pubDate>
      <title>Re: grouping plot handles?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167254#425667</link>
      <author>helper </author>
      <description>&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Heres another problem i'm having:&lt;br&gt;
&amp;gt; in a for loop, i have this statement:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 	if ismember('hNewCam', who) == 1&lt;br&gt;
&amp;gt; 		delete(hNewCam);&lt;br&gt;
&amp;gt; 	end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which is just to prevent the handle from being delete the&lt;br&gt;
&amp;gt; first time through the loop (since it doesn't exist yet). &lt;br&gt;
&amp;gt; The thing is, I get this error:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ??? Error using ==&amp;gt; delete&lt;br&gt;
&amp;gt; Invalid handle object.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; but if I put a breakpoint at the beginning of the loop and&lt;br&gt;
&amp;gt; delete(hNewCam) manually, it works fine!!??&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Try it this way.  Initialize hNewCam before the loop to be &lt;br&gt;
empty:&lt;br&gt;
&lt;br&gt;
hNewCam = [];&lt;br&gt;
&lt;br&gt;
Then, within the loop, use this construct:&lt;br&gt;
&lt;br&gt;
if ishandle(hNewCam)&lt;br&gt;
&amp;nbsp;&amp;nbsp;delete(hNewCam)&lt;br&gt;
end</description>
    </item>
    <item>
      <pubDate>Wed, 09 Apr 2008 16:01:28 -0400</pubDate>
      <title>Re: grouping plot handles?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167254#425671</link>
      <author>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)</author>
      <description>In article &amp;lt;ftiik2$7ni$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
David Doria &amp;lt;daviddoria@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;I would like to do this&lt;br&gt;
&amp;gt;%group 1&lt;br&gt;
&amp;gt;a=plot(0,1,'o');&lt;br&gt;
&amp;gt;b=plot(1,1,'ro');&lt;br&gt;
&lt;br&gt;
As you did not specify axes to plot(), both of them are going to&lt;br&gt;
use the current axis (gca). Unless 'hold on' is in effect, that is&lt;br&gt;
going to result in the second plot, 'b', replacing the first one, and&lt;br&gt;
the handles in 'a' would become invalid.&lt;br&gt;
&lt;br&gt;
&amp;gt;%group 2&lt;br&gt;
&amp;gt;c=plot(1,2,'go');&lt;br&gt;
&lt;br&gt;
Similarily, unless 'hold on', that would delete the plot 'b'.&lt;br&gt;
&lt;br&gt;
&amp;gt;delete(group 1)&lt;br&gt;
&lt;br&gt;
&amp;gt;how would I do that?&lt;br&gt;
&lt;br&gt;
Unless your code is a bit different than what you show here, you&lt;br&gt;
would not need to.&lt;br&gt;
-- &lt;br&gt;
&amp;nbsp;&amp;nbsp;&quot;They called it golf because all the other four letter words&lt;br&gt;
&amp;nbsp;&amp;nbsp;were taken.&quot;                                    -- Walter Hagen</description>
    </item>
  </channel>
</rss>

