<?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: HG&#039;s undocumented parameters interface	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hgs-undocumented-parameters-interface</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Thu, 04 Apr 2013 22:38:47 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Miguel Gaspar		</title>
		<link>https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-184498</link>

		<dc:creator><![CDATA[Miguel Gaspar]]></dc:creator>
		<pubDate>Thu, 04 Apr 2013 22:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3679#comment-184498</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-184476&quot;&gt;Yair Altman&lt;/a&gt;.

Hi, Yair,

Thanks for your reply, and above all, thanks for the continuous stream of pearls you provide...

I would like to use the get() method for two reasons:
- symmetry: it has some aesthetic appeal, feels natural to me;
- laziness: it would allow the use of auto-complete...

not very strong reasons, specially since recent versions of Matlab provide auto-complete of property names in set/get, but still prompted me to write this function:
&lt;pre lang=&quot;matlab&quot;&gt;
function hprops=getset(h)
% Returns only the settable properties for the handle graphics object h, so
% that it can be used directly in the form:
% set(h,hprops)

fn=fieldnames(set(h(1)));
fv=get(h,fn);
hprops=cell2struct(fv&#039;,fn,1);
&lt;/pre&gt;

Unfortunately, although this works for a vector of handles, of same type, returning a vector struct, this can&#039;t be used in &lt;code&gt;set(...)&lt;/code&gt;:
&lt;pre lang=&quot;matlab&quot;&gt;
hlines=findobj(gca,&#039;Type&#039;,&#039;line&#039;);
lineprops=getset(hlines);
lineprops(1).LineStyle=&#039;:&#039;;
lineprops(2).LineStyle=&#039;-&#039;;
set(hlines,lineprops)
&lt;/pre&gt;
since only the last value specified for each property is used, and applied to all handle graphics objects...

A syntax for assigning different values to properties of multiple objects is available for the &lt;code&gt;plot(...)&lt;/code&gt; function, which accepts the following:
&lt;pre lang=&quot;matlab&quot;&gt;
plot(1:4, [2,4,5,8], &#039;r&#039;,...
     1:4, [3 2 1 4], &#039;g&#039;)
&lt;/pre&gt;

My preferred way of working with handle graphics is to use hg objects instead of handles, although in some cases it requires some additional steps:
&lt;pre lang=&quot;matlab&quot;&gt;
hline=hg.line(&#039;XData&#039;,1:4,&#039;YData&#039;,[2,4,5,8]);
hline.Visible=false;
hline.XData=[hline.XData,5];
hline.YData=[hline.YData,3];
hline.Visible=true;
% or:
[hline.XData,hline.YData]=deal([hline.XData,5],[hline.YData,3]);
&lt;/pre&gt;

Which method (set(...) with PV pairs, set(...) with struct, or hg objects) do you prefer?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-184476">Yair Altman</a>.</p>
<p>Hi, Yair,</p>
<p>Thanks for your reply, and above all, thanks for the continuous stream of pearls you provide&#8230;</p>
<p>I would like to use the get() method for two reasons:<br />
&#8211; symmetry: it has some aesthetic appeal, feels natural to me;<br />
&#8211; laziness: it would allow the use of auto-complete&#8230;</p>
<p>not very strong reasons, specially since recent versions of Matlab provide auto-complete of property names in set/get, but still prompted me to write this function:</p>
<pre lang="matlab">
function hprops=getset(h)
% Returns only the settable properties for the handle graphics object h, so
% that it can be used directly in the form:
% set(h,hprops)

fn=fieldnames(set(h(1)));
fv=get(h,fn);
hprops=cell2struct(fv',fn,1);
</pre>
<p>Unfortunately, although this works for a vector of handles, of same type, returning a vector struct, this can&#8217;t be used in <code>set(...)</code>:</p>
<pre lang="matlab">
hlines=findobj(gca,'Type','line');
lineprops=getset(hlines);
lineprops(1).LineStyle=':';
lineprops(2).LineStyle='-';
set(hlines,lineprops)
</pre>
<p>since only the last value specified for each property is used, and applied to all handle graphics objects&#8230;</p>
<p>A syntax for assigning different values to properties of multiple objects is available for the <code>plot(...)</code> function, which accepts the following:</p>
<pre lang="matlab">
plot(1:4, [2,4,5,8], 'r',...
     1:4, [3 2 1 4], 'g')
</pre>
<p>My preferred way of working with handle graphics is to use hg objects instead of handles, although in some cases it requires some additional steps:</p>
<pre lang="matlab">
hline=hg.line('XData',1:4,'YData',[2,4,5,8]);
hline.Visible=false;
hline.XData=[hline.XData,5];
hline.YData=[hline.YData,3];
hline.Visible=true;
% or:
[hline.XData,hline.YData]=deal([hline.XData,5],[hline.YData,3]);
</pre>
<p>Which method (set(&#8230;) with PV pairs, set(&#8230;) with struct, or hg objects) do you prefer?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-184476</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 04 Apr 2013 21:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3679#comment-184476</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-184447&quot;&gt;Miguel Gaspar&lt;/a&gt;.

@Miguel - why not simply pass to &lt;i&gt;&lt;b&gt;set&lt;/b&gt;&lt;/i&gt; only the changed properties, that you can be certain are settable? For example:
 
&lt;pre lang=&#039;matlab&#039;&gt;
hprops = [];
hprops.some_property1 = ...
hprops.some_property2 = ...
set(h,hprops)
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-184447">Miguel Gaspar</a>.</p>
<p>@Miguel &#8211; why not simply pass to <i><b>set</b></i> only the changed properties, that you can be certain are settable? For example:</p>
<pre lang='matlab'>
hprops = [];
hprops.some_property1 = ...
hprops.some_property2 = ...
set(h,hprops)
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Miguel Gaspar		</title>
		<link>https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-184447</link>

		<dc:creator><![CDATA[Miguel Gaspar]]></dc:creator>
		<pubDate>Thu, 04 Apr 2013 19:25:25 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3679#comment-184447</guid>

					<description><![CDATA[I had also noticed this sometime ago. It would seem very useful to use with:
&lt;pre lang=&quot;matlab&quot;&gt;
hprops=get(h);
hprops.some_property=...
set(h,hprops)
&lt;/pre&gt;
but unfortunately &lt;code&gt;get(h)&lt;/code&gt; returns read-only properties, which result in an error when used with &lt;code&gt;set()&lt;/code&gt;:
&lt;pre&gt;
&#062;&#062; set(hl,linep)
??? Error using ==&#062; set
Attempt to modify a property that is read-only.
Object Name :  line
Property Name :  &#039;Annotation&#039;.
&lt;/pre&gt;
Do you know how to overcome this?]]></description>
			<content:encoded><![CDATA[<p>I had also noticed this sometime ago. It would seem very useful to use with:</p>
<pre lang="matlab">
hprops=get(h);
hprops.some_property=...
set(h,hprops)
</pre>
<p>but unfortunately <code>get(h)</code> returns read-only properties, which result in an error when used with <code>set()</code>:</p>
<pre>
&gt;&gt; set(hl,linep)
??? Error using ==&gt; set
Attempt to modify a property that is read-only.
Object Name :  line
Property Name :  'Annotation'.
</pre>
<p>Do you know how to overcome this?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: ishghandle’s undocumented input parameter &#124; Undocumented Matlab		</title>
		<link>https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-180791</link>

		<dc:creator><![CDATA[ishghandle’s undocumented input parameter &#124; Undocumented Matlab]]></dc:creator>
		<pubDate>Wed, 27 Mar 2013 21:09:29 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3679#comment-180791</guid>

					<description><![CDATA[[...] Two weeks ago I wrote about Matlab Handle Graphics (HG) undocumented acceptance of structs as input parameter to some plotting functions. Continuing in a related matter, today I expose an undocumented input parameter for HG&#039;s ishghandle function [...]]]></description>
			<content:encoded><![CDATA[<p>[&#8230;] Two weeks ago I wrote about Matlab Handle Graphics (HG) undocumented acceptance of structs as input parameter to some plotting functions. Continuing in a related matter, today I expose an undocumented input parameter for HG&#8217;s ishghandle function [&#8230;]</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-173123</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 14 Mar 2013 15:17:21 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3679#comment-173123</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-173121&quot;&gt;Eric&lt;/a&gt;.

@Eric - both &lt;i&gt;&lt;b&gt;line&lt;/b&gt;&lt;/i&gt;, &lt;i&gt;&lt;b&gt;patch&lt;/b&gt;&lt;/i&gt; and &lt;i&gt;&lt;b&gt;inputparser&lt;/b&gt;&lt;/i&gt; are internal functions whose contents are not accessible for us to check.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-173121">Eric</a>.</p>
<p>@Eric &#8211; both <i><b>line</b></i>, <i><b>patch</b></i> and <i><b>inputparser</b></i> are internal functions whose contents are not accessible for us to check.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Eric		</title>
		<link>https://undocumentedmatlab.com/articles/hgs-undocumented-parameters-interface#comment-173121</link>

		<dc:creator><![CDATA[Eric]]></dc:creator>
		<pubDate>Thu, 14 Mar 2013 15:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3679#comment-173121</guid>

					<description><![CDATA[Is this behavior because the functions use INPUTPARSER? If so, perhaps it is true for any function that uses inputparser - I haven&#039;t tested it out to see...]]></description>
			<content:encoded><![CDATA[<p>Is this behavior because the functions use INPUTPARSER? If so, perhaps it is true for any function that uses inputparser &#8211; I haven&#8217;t tested it out to see&#8230;</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
