<?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: Commenting Code</title>
	<atom:link href="http://blogs.mathworks.com/loren/2006/08/30/commenting-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/</link>
	<description>Loren Shure works on design of the MATLAB language at MathWorks. She writes here about once a week on MATLAB programming and related topics.</description>
	<lastBuildDate>Thu, 09 Feb 2012 04:19:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-32026</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Fri, 11 Feb 2011 14:51:55 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-32026</guid>
		<description>Alexander-

The first example is a cell array and for array creation, you don&#039;t the ... to add values to the array.  However, for the function, you do need ... to continue lines.  So the explanation is that the first is array creation and the second a function.

FYI, this will also work:
&lt;pre class=&quot;code&quot;&gt;
datafiles={
            &#039;J1lower&#039; 
            %&#039;J1upper&#039; ...
            &#039;S3lower&#039; 
            %&#039;S3upper&#039; ...
            &#039;S4lower&#039; 
            %&#039;S4upper&#039;, ...
            &#039;soilc6lower&#039;, 
            }; %names of datafile(s) without file extension
&lt;/pre&gt;

--Loren</description>
		<content:encoded><![CDATA[<p>Alexander-</p>
<p>The first example is a cell array and for array creation, you don&#8217;t the &#8230; to add values to the array.  However, for the function, you do need &#8230; to continue lines.  So the explanation is that the first is array creation and the second a function.</p>
<p>FYI, this will also work:</p>
<pre class="code">
datafiles={
            'J1lower'
            %'J1upper' ...
            'S3lower'
            %'S3upper' ...
            'S4lower'
            %'S4upper', ...
            'soilc6lower',
            }; %names of datafile(s) without file extension
</pre>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander Graf</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-32023</link>
		<dc:creator>Alexander Graf</dc:creator>
		<pubDate>Fri, 11 Feb 2011 08:46:40 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-32023</guid>
		<description>Hi,

concerning the topic of &quot;block comments&quot; or more generally, the interaction between ... and %:
can someone explain why example 1 works (commenting out some input files) why the 2nd, obviously similar to the thread example, doesn´t? The´re both in the same script.

example 1:

&lt;pre&gt;
datafiles={...
            &#039;J1lower&#039; ...
            %&#039;J1upper&#039; ...
            &#039;S3lower&#039; ...
            %&#039;S3upper&#039; ...
            &#039;S4lower&#039; ...
            %&#039;S4upper&#039;, ...
            &#039;soilc6lower&#039;, ...
            }; %names of datafile(s) without file extension
&lt;/pre&gt;

example 2:
&lt;pre&gt;
plot(ind,reslts(:,1),&#039;.&#039;...
            %,ind,reslts(:,3),&#039;*&#039;...
            %,ind,reslts(:,5),&#039;o&#039;...
            ,ind,reslts(:,7),&#039;+&#039;...
            ,ind,reslts(:,9),&#039;-&#039;...
            ,ind,reslts(:,11),&#039;-&#039;)...
            );
&lt;/pre&gt;

(Yes I will also be happy about any comment that these two problems can be solved better anyways, but still understanding how ... and % ineract would really be interesting!)</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>concerning the topic of &#8220;block comments&#8221; or more generally, the interaction between &#8230; and %:<br />
can someone explain why example 1 works (commenting out some input files) why the 2nd, obviously similar to the thread example, doesn´t? The´re both in the same script.</p>
<p>example 1:</p>
<pre>
datafiles={...
            'J1lower' ...
            %'J1upper' ...
            'S3lower' ...
            %'S3upper' ...
            'S4lower' ...
            %'S4upper', ...
            'soilc6lower', ...
            }; %names of datafile(s) without file extension
</pre>
<p>example 2:</p>
<pre>
plot(ind,reslts(:,1),'.'...
            %,ind,reslts(:,3),'*'...
            %,ind,reslts(:,5),'o'...
            ,ind,reslts(:,7),'+'...
            ,ind,reslts(:,9),'-'...
            ,ind,reslts(:,11),'-')...
            );
</pre>
<p>(Yes I will also be happy about any comment that these two problems can be solved better anyways, but still understanding how &#8230; and % ineract would really be interesting!)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-31926</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 20 Dec 2010 16:16:06 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-31926</guid>
		<description>Fab-

Another interesting technique.  Thanks.\

--Loren</description>
		<content:encoded><![CDATA[<p>Fab-</p>
<p>Another interesting technique.  Thanks.\</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fab</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-31925</link>
		<dc:creator>Fab</dc:creator>
		<pubDate>Mon, 20 Dec 2010 16:01:54 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-31925</guid>
		<description>I know this is a 4 year old blog post, but it is still found by Google (which is how I got here) so I think it&#039;s still worth answering:

I would recommend not to use the code suggested by Loren as it makes the whole code less readable. Block comments should only be used to comment out blocks of codes, not small fragments or single lines.

Although the % does not work in a multi-line command, there is absolutely no need to use it. Putting a ... in front of the line has the same effect except for keeping the multi-line command intact:

&lt;pre&gt;
t = pi:pi/20:5*pi;
sinc = sin(30*t)./t;
h = plot(t,sinc);
set(h,...
    &#039;linestyle&#039;,&#039;--&#039;,...
    &#039;color&#039;,&#039;m&#039;,...
    &#039;marker&#039;,&#039;diamond&#039;,...
    &#039;markersize&#039;,8,...
...    &#039;markerfacecolor&#039;,&#039;c&#039;,...
    &#039;markeredgecolor&#039;,&#039;b&#039;...
   )
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I know this is a 4 year old blog post, but it is still found by Google (which is how I got here) so I think it&#8217;s still worth answering:</p>
<p>I would recommend not to use the code suggested by Loren as it makes the whole code less readable. Block comments should only be used to comment out blocks of codes, not small fragments or single lines.</p>
<p>Although the % does not work in a multi-line command, there is absolutely no need to use it. Putting a &#8230; in front of the line has the same effect except for keeping the multi-line command intact:</p>
<pre>
t = pi:pi/20:5*pi;
sinc = sin(30*t)./t;
h = plot(t,sinc);
set(h,...
    'linestyle','--',...
    'color','m',...
    'marker','diamond',...
    'markersize',8,...
...    'markerfacecolor','c',...
    'markeredgecolor','b'...
   )
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-25765</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 04 Feb 2008 14:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-25765</guid>
		<description>Ron-

Sorry for the broken link.  Here is the link for block comments:

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f2-53314.html#f2-53527

--Loren</description>
		<content:encoded><![CDATA[<p>Ron-</p>
<p>Sorry for the broken link.  Here is the link for block comments:</p>
<p><a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f2-53314.html#f2-53527" rel="nofollow">http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f2-53314.html#f2-53527</a></p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ron</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-25685</link>
		<dc:creator>Ron</dc:creator>
		<pubDate>Sat, 02 Feb 2008 14:47:28 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-25685</guid>
		<description>FYI, the block comment link seems to be broken again. In my case, I&#039;m using block comments to disable a section of a long m-file function to see how much faster it will run. The current function takes 8 hrs to run on a fast machine.</description>
		<content:encoded><![CDATA[<p>FYI, the block comment link seems to be broken again. In my case, I&#8217;m using block comments to disable a section of a long m-file function to see how much faster it will run. The current function takes 8 hrs to run on a fast machine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Memming</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-23492</link>
		<dc:creator>Memming</dc:creator>
		<pubDate>Tue, 18 Dec 2007 13:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-23492</guid>
		<description>Here&#039;s how to enable syntax coloring in Vim.
http://blog.memming.com/entry/block-commenting-in-MATLAB-and-syntax-highlighting-in-vim</description>
		<content:encoded><![CDATA[<p>Here&#8217;s how to enable syntax coloring in Vim.<br />
<a href="http://blog.memming.com/entry/block-commenting-in-MATLAB-and-syntax-highlighting-in-vim" rel="nofollow">http://blog.memming.com/entry/block-commenting-in-MATLAB-and-syntax-highlighting-in-vim</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oliver A. Chapman, PE</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-10034</link>
		<dc:creator>Oliver A. Chapman, PE</dc:creator>
		<pubDate>Wed, 06 Sep 2006 18:12:17 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-10034</guid>
		<description>Loren,

Thanks, now I understand what these &quot;block comments&quot; are.  I can see how they might be used with prototype code: e.g., you can disable a section of code and observe the behavior of the rest when you execute it.

However, I can&#039;t see how I would use it.  There is a risk that I will visually miss the section that is commented out.  Using the &quot;%&quot; at the beginning of each line in the block makes the commented section visually prominent.  Since the MatLab editor has the feature to automate the adding of the &quot;%&quot; to the selected lines, why use this &quot;riskier&quot; technique?

I see that the MatLab editor will color code both techniques to aid in the visual prominence, so I suppose the risk of missing the comments is low.

I understand that a similar feature is available in C, so likely The MathWorks has received requests for this feature from their customers and it is always good to accommodate your customers.

But, for final code, I want the comments to really stand out as visually separate from the commands, so I&#039;ll continue to use &quot;%&quot; on each line.

Sorry I missed you in Seattle today.  I wanted to attend your seminar, but schedule issues prevented it.</description>
		<content:encoded><![CDATA[<p>Loren,</p>
<p>Thanks, now I understand what these &#8220;block comments&#8221; are.  I can see how they might be used with prototype code: e.g., you can disable a section of code and observe the behavior of the rest when you execute it.</p>
<p>However, I can&#8217;t see how I would use it.  There is a risk that I will visually miss the section that is commented out.  Using the &#8220;%&#8221; at the beginning of each line in the block makes the commented section visually prominent.  Since the MatLab editor has the feature to automate the adding of the &#8220;%&#8221; to the selected lines, why use this &#8220;riskier&#8221; technique?</p>
<p>I see that the MatLab editor will color code both techniques to aid in the visual prominence, so I suppose the risk of missing the comments is low.</p>
<p>I understand that a similar feature is available in C, so likely The MathWorks has received requests for this feature from their customers and it is always good to accommodate your customers.</p>
<p>But, for final code, I want the comments to really stand out as visually separate from the commands, so I&#8217;ll continue to use &#8220;%&#8221; on each line.</p>
<p>Sorry I missed you in Seattle today.  I wanted to attend your seminar, but schedule issues prevented it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-10020</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 05 Sep 2006 21:34:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-10020</guid>
		<description>Oliver-

I fixed the link.  It broke with the release of R2006b.  Thanks for catching it.

Block comments are delimiters around a block (of anything you want to be in comments).  They start with a line like this:

%{

and end with a line like this

%}

See lines 11 and 13 in the last code block in the blog.

Using them, you don&#039;t need to have % in front of every line in between, sometimes rendering the comment more readable.  In the case of comment embedded in a code that continues on multiple lines, block comments also render the remaining code usable.

--Loren</description>
		<content:encoded><![CDATA[<p>Oliver-</p>
<p>I fixed the link.  It broke with the release of R2006b.  Thanks for catching it.</p>
<p>Block comments are delimiters around a block (of anything you want to be in comments).  They start with a line like this:</p>
<p>%{</p>
<p>and end with a line like this</p>
<p>%}</p>
<p>See lines 11 and 13 in the last code block in the blog.</p>
<p>Using them, you don&#8217;t need to have % in front of every line in between, sometimes rendering the comment more readable.  In the case of comment embedded in a code that continues on multiple lines, block comments also render the remaining code usable.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oliver A. Chapman, PE</title>
		<link>http://blogs.mathworks.com/loren/2006/08/30/commenting-code/#comment-10019</link>
		<dc:creator>Oliver A. Chapman, PE</dc:creator>
		<pubDate>Tue, 05 Sep 2006 20:01:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=52#comment-10019</guid>
		<description>Loren,

Could you explain your term, &quot;block comments?&quot;  The link in your article appears to be broken and I haven&#039;t been able to figure out if it is a type of MatLab command, MatLab editor command or just a general term applying to a style of comments.  I did find a reference to the term on the MathWorks web site, but that is broken also.  It appeared to refer to a section of MatLab documentation:

Adding Comments :: Editing and Debugging M-Files(Desktop Tools and Development Environment)

But, I can&#039;t find that by surfing thru the documentation contents.</description>
		<content:encoded><![CDATA[<p>Loren,</p>
<p>Could you explain your term, &#8220;block comments?&#8221;  The link in your article appears to be broken and I haven&#8217;t been able to figure out if it is a type of MatLab command, MatLab editor command or just a general term applying to a style of comments.  I did find a reference to the term on the MathWorks web site, but that is broken also.  It appeared to refer to a section of MatLab documentation:</p>
<p>Adding Comments :: Editing and Debugging M-Files(Desktop Tools and Development Environment)</p>
<p>But, I can&#8217;t find that by surfing thru the documentation contents.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

