<?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: Undocumented classdef attributes	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/undocumented-classdef-attributes/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=undocumented-classdef-attributes</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Tue, 26 Oct 2021 15:49:35 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Jan		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-511971</link>

		<dc:creator><![CDATA[Jan]]></dc:creator>
		<pubDate>Tue, 26 Oct 2021 15:49:35 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-511971</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-421606&quot;&gt;Sam Roberts&lt;/a&gt;.

Any updates on this development? I just raised a similar question there: &lt;a href=&quot;https://www.mathworks.com/matlabcentral/answers/1571813-custom-class-properties-and-method-attributes?s_tid=mlc_ans_email_view#comment_1801123&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;https://www.mathworks.com/matlabcentral/answers/1571813-custom-class-properties-and-method-attributes?s_tid=mlc_ans_email_view#comment_1801123&lt;/a&gt; and after searching for &quot;Description attribute&quot; I ended up here :D]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-421606">Sam Roberts</a>.</p>
<p>Any updates on this development? I just raised a similar question there: <a href="https://www.mathworks.com/matlabcentral/answers/1571813-custom-class-properties-and-method-attributes?s_tid=mlc_ans_email_view#comment_1801123" target="_blank" rel="nofollow">https://www.mathworks.com/matlabcentral/answers/1571813-custom-class-properties-and-method-attributes?s_tid=mlc_ans_email_view#comment_1801123</a> and after searching for &#8220;Description attribute&#8221; I ended up here 😀</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Sam Roberts		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-421606</link>

		<dc:creator><![CDATA[Sam Roberts]]></dc:creator>
		<pubDate>Wed, 28 Mar 2018 15:59:32 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-421606</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-421593&quot;&gt;Maarten van der Seijs&lt;/a&gt;.

Maarten,

No, you can&#039;t do that, although MathWorks are considering the possibility for a future enhancement. A similar question was asked on StackOverflow a while ago (https://stackoverflow.com/questions/26710767/which-methods-keywords-i-e-testmethodsetup-can-occur-in-matlab/26733613#26733613) and received a couple of answers, one of which was from Andy Campbell, a senior developer at MathWorks. See the comment thread under his answer.

In the meantime, it is sometimes possible to achieve your aims by abusing the undocumented attributes &lt;code&gt;Description&lt;/code&gt; and &lt;code&gt;DetailedDescription&lt;/code&gt;.
These are undocumented, but are always present (on class, method, property and event elements), and accept a string value that you can use to store essentially whatever you want. Some built-in classes such as &lt;code&gt;containers.Map&lt;/code&gt; use them to store a description of the class.

Because they are undocumented, if you use them they will cause a red underline in the MATLAB editor (without any actual runtime error). You can suppress this using &lt;code&gt;%#ok&#060;ATUNK&#062;&lt;/code&gt; at the end of the line.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-421593">Maarten van der Seijs</a>.</p>
<p>Maarten,</p>
<p>No, you can&#8217;t do that, although MathWorks are considering the possibility for a future enhancement. A similar question was asked on StackOverflow a while ago (<a href="https://stackoverflow.com/questions/26710767/which-methods-keywords-i-e-testmethodsetup-can-occur-in-matlab/26733613#26733613" rel="nofollow ugc">https://stackoverflow.com/questions/26710767/which-methods-keywords-i-e-testmethodsetup-can-occur-in-matlab/26733613#26733613</a>) and received a couple of answers, one of which was from Andy Campbell, a senior developer at MathWorks. See the comment thread under his answer.</p>
<p>In the meantime, it is sometimes possible to achieve your aims by abusing the undocumented attributes <code>Description</code> and <code>DetailedDescription</code>.<br />
These are undocumented, but are always present (on class, method, property and event elements), and accept a string value that you can use to store essentially whatever you want. Some built-in classes such as <code>containers.Map</code> use them to store a description of the class.</p>
<p>Because they are undocumented, if you use them they will cause a red underline in the MATLAB editor (without any actual runtime error). You can suppress this using <code>%#ok&lt;ATUNK&gt;</code> at the end of the line.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Maarten van der Seijs		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-421593</link>

		<dc:creator><![CDATA[Maarten van der Seijs]]></dc:creator>
		<pubDate>Wed, 28 Mar 2018 11:12:51 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-421593</guid>

					<description><![CDATA[I&#039;ve been looking for ways to define custom attributes for classes and class methods/properties. I&#039;ve noticed that some internal matlab classes define additional attributes, such as the unit test classes derived from &lt;code&gt;matlab.unittest.TestCase&lt;/code&gt;. This can be nicely observed from its meta class:
&lt;pre lang=&quot;matlab&quot;&gt;
&gt;&gt; mTestClass = meta.class.fromName(&#039;matlab.unittest.TestCase&#039;);
&gt;&gt; mTestMethod = mClass.MethodList(1)
mTestMethod = 
  method with properties:
                    Test: 0
         TestMethodSetup: 0
      TestMethodTeardown: 0
          TestClassSetup: 0
       TestClassTeardown: 0
    ParameterCombination: &#039;&#039;
                TestTags: {}
                    Name: &#039;TestCase&#039;
             Description: &#039;&#039;
     DetailedDescription: &#039;&#039;
                     ...
&lt;/pre&gt;

The top 7 properties correspond to the method attributes that are available in the method definition blocks, for classes derived from &lt;code&gt;matlab.unittest.TestCase&lt;/code&gt;. Apparently these have been added by subclassing the &lt;code&gt;meta.method&lt;/code&gt; object to the new &lt;code&gt;matlab.unittest.meta.method&lt;/code&gt;, which is indeed the meta class that is returned for classes derived from the superclass &lt;code&gt;matlab.unittest.TestCase&lt;/code&gt;. 

My question is: do you know of any (undocumented) means to define such attributes ourselves, such that you could do something like this?
&lt;pre lang=&quot;matlab&quot;&gt;
classdef MyClass &lt; MyBaseClass
    methods (CustomAttribute = &quot;Custom attribute value&quot;)
       ...
    end
end
&lt;/pre&gt;

Any insight or directions would be highly appreciated!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking for ways to define custom attributes for classes and class methods/properties. I&#8217;ve noticed that some internal matlab classes define additional attributes, such as the unit test classes derived from <code>matlab.unittest.TestCase</code>. This can be nicely observed from its meta class:</p>
<pre lang="matlab">
>> mTestClass = meta.class.fromName('matlab.unittest.TestCase');
>> mTestMethod = mClass.MethodList(1)
mTestMethod = 
  method with properties:
                    Test: 0
         TestMethodSetup: 0
      TestMethodTeardown: 0
          TestClassSetup: 0
       TestClassTeardown: 0
    ParameterCombination: ''
                TestTags: {}
                    Name: 'TestCase'
             Description: ''
     DetailedDescription: ''
                     ...
</pre>
<p>The top 7 properties correspond to the method attributes that are available in the method definition blocks, for classes derived from <code>matlab.unittest.TestCase</code>. Apparently these have been added by subclassing the <code>meta.method</code> object to the new <code>matlab.unittest.meta.method</code>, which is indeed the meta class that is returned for classes derived from the superclass <code>matlab.unittest.TestCase</code>. </p>
<p>My question is: do you know of any (undocumented) means to define such attributes ourselves, such that you could do something like this?</p>
<pre lang="matlab">
classdef MyClass < MyBaseClass
    methods (CustomAttribute = "Custom attribute value")
       ...
    end
end
</pre>
<p>Any insight or directions would be highly appreciated!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Terry Brennan		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-362896</link>

		<dc:creator><![CDATA[Terry Brennan]]></dc:creator>
		<pubDate>Tue, 01 Dec 2015 05:48:18 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-362896</guid>

					<description><![CDATA[The use of the Description attribute in a classdef alters the behavior of the command line help. Normally
&lt;pre lang=&#039;matlab&#039;&gt;&gt;&gt; help classname&lt;/pre&gt;
echoes the comments under the classdef line and
&lt;pre lang=&#039;matlab&#039;&gt;&gt;&gt; help classname.classname&lt;/pre&gt;
echoes the comments under the function constructor. When Description is specified]]></description>
			<content:encoded><![CDATA[<p>The use of the Description attribute in a classdef alters the behavior of the command line help. Normally</p>
<pre lang='matlab'>>> help classname</pre>
<p>echoes the comments under the classdef line and</p>
<pre lang='matlab'>>> help classname.classname</pre>
<p>echoes the comments under the function constructor. When Description is specified</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ben Abbott		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327881</link>

		<dc:creator><![CDATA[Ben Abbott]]></dc:creator>
		<pubDate>Mon, 14 Jul 2014 22:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-327881</guid>

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

Ok that makes sense, and explains the clumsy behavior below.
&lt;pre lang=&#039;matlab&#039;&gt;
&gt;&gt; foo(3) = scatteredInterpolant
foo = 
  1x3 scatteredInterpolant array with properties:

    Points
    Values
    Method
    ExtrapolationMethod

&gt;&gt; foo(3)
ans =
     []
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327854">Yair Altman</a>.</p>
<p>Ok that makes sense, and explains the clumsy behavior below.</p>
<pre lang='matlab'>
>> foo(3) = scatteredInterpolant
foo = 
  1x3 scatteredInterpolant array with properties:

    Points
    Values
    Method
    ExtrapolationMethod

>> foo(3)
ans =
     []
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327854</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Mon, 14 Jul 2014 12:53:04 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-327854</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327783&quot;&gt;Ben Abbott&lt;/a&gt;.

I see what you mean, but I don&#039;t think it is related. &lt;b&gt;&lt;i&gt;scatteredInterpolant&lt;/i&gt;&lt;/b&gt; simply overloaded the &lt;i&gt;subsref(), subsasgn(), end()&lt;/i&gt; methods for this functionality. You can do it in any user class.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327783">Ben Abbott</a>.</p>
<p>I see what you mean, but I don&#8217;t think it is related. <b><i>scatteredInterpolant</i></b> simply overloaded the <i>subsref(), subsasgn(), end()</i> methods for this functionality. You can do it in any user class.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ben Abbott		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327853</link>

		<dc:creator><![CDATA[Ben Abbott]]></dc:creator>
		<pubDate>Mon, 14 Jul 2014 12:28:53 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-327853</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327783&quot;&gt;Ben Abbott&lt;/a&gt;.

@Yair - Sorry, I wasn&#039;t clear.  Each instance of scatteredInterpolant is a function.
&lt;pre lang=&quot;matlab&quot;&gt;
foo = scatteredInterpolant (x, y, z); 
c = foo (a, b);
&lt;/pre&gt;
I don&#039;t think their is a documented way to produce a class (via classdef) that supports the feature, c=foo(a,b).  From the name of the attribute SupportClassFunctions I inferred this may needed to allow foo to be used as a function.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327783">Ben Abbott</a>.</p>
<p>@Yair &#8211; Sorry, I wasn&#8217;t clear.  Each instance of scatteredInterpolant is a function.</p>
<pre lang="matlab">
foo = scatteredInterpolant (x, y, z); 
c = foo (a, b);
</pre>
<p>I don&#8217;t think their is a documented way to produce a class (via classdef) that supports the feature, c=foo(a,b).  From the name of the attribute SupportClassFunctions I inferred this may needed to allow foo to be used as a function.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327817</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Sun, 13 Jul 2014 23:12:20 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-327817</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327783&quot;&gt;Ben Abbott&lt;/a&gt;.

@Ben - I don&#039;t think I follow you - &lt;i&gt;&lt;b&gt;scatteredInterpolant&lt;/b&gt;&lt;/i&gt; is a simple Matlab class, not a function (see &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/scatteredinterpolant-class.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;).]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327783">Ben Abbott</a>.</p>
<p>@Ben &#8211; I don&#8217;t think I follow you &#8211; <i><b>scatteredInterpolant</b></i> is a simple Matlab class, not a function (see <a href="http://www.mathworks.com/help/matlab/ref/scatteredinterpolant-class.html" rel="nofollow">here</a>).</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ben Abbott		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-327783</link>

		<dc:creator><![CDATA[Ben Abbott]]></dc:creator>
		<pubDate>Sun, 13 Jul 2014 00:08:39 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-327783</guid>

					<description><![CDATA[Regarding &lt;code&gt;SupportClassFunctions&lt;/code&gt;, would that allow instances of a class to be used as a function?  In the same manner as core class/functions like &lt;code&gt;scatteredInterpolant&lt;/code&gt;?]]></description>
			<content:encoded><![CDATA[<p>Regarding <code>SupportClassFunctions</code>, would that allow instances of a class to be used as a function?  In the same manner as core class/functions like <code>scatteredInterpolant</code>?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-196548</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 01 May 2013 15:48:40 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3315#comment-196548</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-196546&quot;&gt;Chris Hoogeboom&lt;/a&gt;.

@Chris - take a look at the &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/25925-using-doxygen-with-matlab&quot; rel=&quot;nofollow&quot;&gt;Doxygen for Matlab&lt;/a&gt; utility on the File Exchange - no need to reinvent the wheel...]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/undocumented-classdef-attributes#comment-196546">Chris Hoogeboom</a>.</p>
<p>@Chris &#8211; take a look at the <a href="http://www.mathworks.com/matlabcentral/fileexchange/25925-using-doxygen-with-matlab" rel="nofollow">Doxygen for Matlab</a> utility on the File Exchange &#8211; no need to reinvent the wheel&#8230;</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
