<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Legend &#8216;-DynamicLegend&#8217; semi-documented feature</title> <atom:link href="http://undocumentedmatlab.com/blog/legend-semi-documented-feature/feed/" rel="self" type="application/rss+xml" /><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/</link> <description>Charting Matlab's unsupported hidden underbelly</description> <lastBuildDate>Fri, 18 May 2012 13:56:51 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1.1</generator> <item><title>By: Customizing menu items part 1 &#124; Undocumented Matlab</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-83190</link> <dc:creator>Customizing menu items part 1 &#124; Undocumented Matlab</dc:creator> <pubDate>Wed, 25 Apr 2012 18:14:22 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-83190</guid> <description>[...]  Menu callbacks generally use internal semi-documented functions (i.e., having a readable help section but no doc, online help, or official support) [...]</description> <content:encoded><![CDATA[<p>[...]  Menu callbacks generally use internal semi-documented functions (i.e., having a readable help section but no doc, online help, or official support) [...]</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-78517</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Wed, 21 Mar 2012 19:27:45 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-78517</guid> <description>@Stephan - yes: You can access the Refresh uicontextmenu item (and any other context-menu item) directly from the legend axes, and then run it via the &lt;a href=&quot;http://undocumentedmatlab.com/blog/hgfeval/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;&lt;b&gt;&lt;i&gt;hgfeval&lt;/i&gt;&lt;/b&gt; function&lt;/a&gt;, as follows:&lt;pre lang=&quot;matlab&quot;&gt;
hLegend = findall(gcf,&#039;tag&#039;,&#039;legend&#039;);
uic = get(hLegend,&#039;UIContextMenu&#039;);
uimenu_refresh = findall(uic,&#039;Label&#039;,&#039;Refresh&#039;);
callback = get(uimenu_refresh,&#039;Callback&#039;);
hgfeval(callback,[],[]);
&lt;/pre&gt;For the record, this invokes the &lt;i&gt;refresh_cb&lt;/i&gt; function within &lt;i&gt;%matlabroot%/toolbox/matlab/scribe/@scribe/@legend/methods.m&lt;/i&gt;. You can place a breakpoint there to see exactly what it does internally.</description> <content:encoded><![CDATA[<p>@Stephan &#8211; yes: You can access the Refresh uicontextmenu item (and any other context-menu item) directly from the legend axes, and then run it via the <a
href="http://undocumentedmatlab.com/blog/hgfeval/" target="_blank" rel="nofollow"><b><i>hgfeval</i></b> function</a>, as follows:</p><div
class="wp_syntax"><div
class="code"><pre class="matlab" style="font-family:monospace;">hLegend = findall<span style="color: #080;">&#40;</span><span style="color: #0000FF;">gcf</span>,<span style="color:#A020F0;">'tag'</span>,<span style="color:#A020F0;">'legend'</span><span style="color: #080;">&#41;</span>;
uic = <span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>hLegend,<span style="color:#A020F0;">'UIContextMenu'</span><span style="color: #080;">&#41;</span>;
uimenu_refresh = findall<span style="color: #080;">&#40;</span>uic,<span style="color:#A020F0;">'Label'</span>,<span style="color:#A020F0;">'Refresh'</span><span style="color: #080;">&#41;</span>;
callback = <span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>uimenu_refresh,<span style="color:#A020F0;">'Callback'</span><span style="color: #080;">&#41;</span>;
hgfeval<span style="color: #080;">&#40;</span>callback,<span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>,<span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>;</pre></div></div><p>For the record, this invokes the <i>refresh_cb</i> function within <i>%matlabroot%/toolbox/matlab/scribe/@scribe/@legend/methods.m</i>. You can place a breakpoint there to see exactly what it does internally.</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-78028</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Sat, 17 Mar 2012 18:41:29 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-78028</guid> <description>@Teodor - try placing a &lt;b&gt;&lt;i&gt;drawnow&lt;/i&gt;&lt;/b&gt; after plotting the lines and before trying to access the hidden &lt;b&gt;ScribeLegendListeners&lt;/b&gt; property. It is also possible that you are trying to access this property on a handle of another object (maybe one of the line plots, or a figure, or another axes), rather than the handle of the axes that holds the plots for the requested legend.</description> <content:encoded><![CDATA[<p>@Teodor &#8211; try placing a <b><i>drawnow</i></b> after plotting the lines and before trying to access the hidden <b>ScribeLegendListeners</b> property. It is also possible that you are trying to access this property on a handle of another object (maybe one of the line plots, or a figure, or another axes), rather than the handle of the axes that holds the plots for the requested legend.</p> ]]></content:encoded> </item> <item><title>By: Teodor</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-77742</link> <dc:creator>Teodor</dc:creator> <pubDate>Thu, 15 Mar 2012 20:26:11 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-77742</guid> <description>Hi. Thank you for this post. At the moment I am a bit stuck as trying to get the &#039;ScribeLegendListeners&#039; throws a &#039;MATLAB:class:InvalidProperty&#039; exception. There seem to be no such property...My University is using Matlab-R2011a. Could it be something related to their installation?What I am doing is using -DynamicLegend for plotting data in multiple iterations. However, I need to remove from the legend some plotted lines.Could you recommend other solutions? Thank you.</description> <content:encoded><![CDATA[<p>Hi. Thank you for this post. At the moment I am a bit stuck as trying to get the &#8216;ScribeLegendListeners&#8217; throws a &#8216;MATLAB:class:InvalidProperty&#8217; exception. There seem to be no such property&#8230;</p><p>My University is using Matlab-R2011a. Could it be something related to their installation?</p><p>What I am doing is using -DynamicLegend for plotting data in multiple iterations. However, I need to remove from the legend some plotted lines.</p><p>Could you recommend other solutions? Thank you.</p> ]]></content:encoded> </item> <item><title>By: sunny</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-77724</link> <dc:creator>sunny</dc:creator> <pubDate>Thu, 15 Mar 2012 16:40:26 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-77724</guid> <description>wow, i never knew there was a function like this and i have been thinking on how to program it. thanks, this is gonna save me lots of time</description> <content:encoded><![CDATA[<p>wow, i never knew there was a function like this and i have been thinking on how to program it. thanks, this is gonna save me lots of time</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-75843</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Mon, 27 Feb 2012 23:47:42 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-75843</guid> <description>@Stephan and @Andy - the Legend&#039;s DynamicLegend functionality only listens to newly-created axes children (in &lt;i&gt;%matlabroot%/toolbox/matlab/scribe/@scribe/@legend/init.m&lt;/i&gt; line 102 [for R2012aPR]), and axes children deletions (in &lt;i&gt;%matlabroot%/toolbox/matlab/scribe/@scribe/@legend/methods.m&lt;/i&gt; line 1281 [R2012aPR again]).It should be relatively easy to modify any of these two places to listen to changes in the &lt;b&gt;Visible&lt;/b&gt; property of axes children. I described the mechanism for doing this in several articles (&lt;a href=&quot;http://undocumentedmatlab.com/blog/continuous-slider-callback/#Property_Listener&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for example).</description> <content:encoded><![CDATA[<p>@Stephan and @Andy &#8211; the Legend&#8217;s DynamicLegend functionality only listens to newly-created axes children (in <i>%matlabroot%/toolbox/matlab/scribe/@scribe/@legend/init.m</i> line 102 [for R2012aPR]), and axes children deletions (in <i>%matlabroot%/toolbox/matlab/scribe/@scribe/@legend/methods.m</i> line 1281 [R2012aPR again]).</p><p>It should be relatively easy to modify any of these two places to listen to changes in the <b>Visible</b> property of axes children. I described the mechanism for doing this in several articles (<a
href="http://undocumentedmatlab.com/blog/continuous-slider-callback/#Property_Listener" target="_blank" rel="nofollow">here</a> for example).</p> ]]></content:encoded> </item> <item><title>By: Andy</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-75792</link> <dc:creator>Andy</dc:creator> <pubDate>Mon, 27 Feb 2012 12:41:00 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-75792</guid> <description>I got the same Problem/Question as Stephan I do plot all data in the Fig however only some data is visible but in the legend all data even the one not visible is listed. Only by right klick an refresh I can get rid of them however I can&#039;t do that with every single file....Hope there will be a solution in the future.</description> <content:encoded><![CDATA[<p>I got the same Problem/Question as Stephan I do plot all data in the Fig however only some data is visible but in the legend all data even the one not visible is listed. Only by right klick an refresh I can get rid of them however I can&#8217;t do that with every single file&#8230;.</p><p>Hope there will be a solution in the future.</p> ]]></content:encoded> </item> <item><title>By: Stephan</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-70611</link> <dc:creator>Stephan</dc:creator> <pubDate>Thu, 12 Jan 2012 13:18:14 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-70611</guid> <description>I was searching for a way to use a legend&#039;s &quot;refresh&quot; function (that is available when right-clicking on the legend with the mouse) in a script. When I came across this post I first thought this was the way Matlab implemented the &quot;refresh&quot; functionality.
However, &#039;DynamicLegend&#039; only seems to react to additions or deletions to the axes: switching the &#039;Visibility&#039; of a line to &#039;off&#039; or switching the legend entry off by
&lt;pre lang=&quot;matlab&quot;&gt;
set(get(get(line_handle,&#039;Annotation&#039;),&#039;LegendInformation&#039;),&#039;IconDisplayStyle&#039;,&#039;off&#039;)
&lt;/pre&gt;
is ignored by the &#039;DynamicLegend&#039; feature. The &quot;refresh&quot; function correctly removes the corresponding legend entry in these cases.
Do you know how to use &quot;refresh&quot; from the command line?</description> <content:encoded><![CDATA[<p>I was searching for a way to use a legend&#8217;s &#8220;refresh&#8221; function (that is available when right-clicking on the legend with the mouse) in a script. When I came across this post I first thought this was the way Matlab implemented the &#8220;refresh&#8221; functionality.<br
/> However, &#8216;DynamicLegend&#8217; only seems to react to additions or deletions to the axes: switching the &#8216;Visibility&#8217; of a line to &#8216;off&#8217; or switching the legend entry off by</p><div
class="wp_syntax"><div
class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span><span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span><span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>line_handle,<span style="color:#A020F0;">'Annotation'</span><span style="color: #080;">&#41;</span>,<span style="color:#A020F0;">'LegendInformation'</span><span style="color: #080;">&#41;</span>,<span style="color:#A020F0;">'IconDisplayStyle'</span>,<span style="color:#A020F0;">'off'</span><span style="color: #080;">&#41;</span></pre></div></div><p>is ignored by the &#8216;DynamicLegend&#8217; feature. The &#8220;refresh&#8221; function correctly removes the corresponding legend entry in these cases.<br
/> Do you know how to use &#8220;refresh&#8221; from the command line?</p> ]]></content:encoded> </item> <item><title>By: Uitable sorting &#124; Undocumented Matlab</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-52359</link> <dc:creator>Uitable sorting &#124; Undocumented Matlab</dc:creator> <pubDate>Tue, 26 Jul 2011 18:03:51 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-52359</guid> <description>[...] After many years in which the &lt;i&gt;&lt;b&gt;uitable&lt;/b&gt;&lt;/i&gt; was available but semi-documented and not officially supported in Matlab, it finally became fully documented and supported in R2008a [...]</description> <content:encoded><![CDATA[<p>[...] After many years in which the <i><b>uitable</b></i> was available but semi-documented and not officially supported in Matlab, it finally became fully documented and supported in R2008a [...]</p> ]]></content:encoded> </item> <item><title>By: handle2struct, struct2handle &#38; Matlab 8.0 &#124; Undocumented Matlab</title><link>http://undocumentedmatlab.com/blog/legend-semi-documented-feature/#comment-27566</link> <dc:creator>handle2struct, struct2handle &#38; Matlab 8.0 &#124; Undocumented Matlab</dc:creator> <pubDate>Wed, 29 Dec 2010 18:02:59 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=357#comment-27566</guid> <description>[...] under the hood, &lt;i&gt;&lt;b&gt;hgsave&lt;/b&gt;&lt;/i&gt; uses the semi-documented built-in &lt;i&gt;&lt;b&gt;handle2struct&lt;/b&gt;&lt;/i&gt; function to convert the figure handle into a Matlab struct [...]</description> <content:encoded><![CDATA[<p>[...] under the hood, <i><b>hgsave</b></i> uses the semi-documented built-in <i><b>handle2struct</b></i> function to convert the figure handle into a Matlab struct [...]</p> ]]></content:encoded> </item> </channel> </rss>

<!-- W3 Total Cache: Minify debug info:
Engine:             disk: basic
Theme:              b7666
Template:           single
-->
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: undocumentedmatlab.com @ 2012-05-18 23:13:57 -->

<!-- W3 Total Cache: Page cache debug info:
Engine:             disk: enhanced
Cache key:          blog/legend-semi-documented-feature/feed/_index.xml_gzip
Caching:            enabled
Status:             not cached
Creation Time:      0.445s
Header info:
X-Pingback:         http://undocumentedmatlab.com/blog/xmlrpc.php
Set-Cookie:         wpgb_visit_last_php-default=1337408037; expires=Sun, 19-May-2013 06:13:57 GMT; path=/
Link:               <http://undocumentedmatlab.com/?p=357>; rel=shortlink
Content-Type:       text/xml; charset=UTF-8
Last-Modified:      Sat, 19 May 2012 06:13:57 GMT
Vary:               Accept-Encoding, Cookie
Expires:            Sat, 19 May 2012 07:13:57 GMT
Pragma:             public
Cache-Control:      public, must-revalidate, proxy-revalidate
Etag:               008d58233c5f780df45fe0a2776ff0b5
Content-Encoding:   gzip
-->
