<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Cleaner code in MATLAB part one of series</title>
	<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/</link>
	<description>&#60;a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=969735&#38;objectType=author"&#62;Bob&#60;/a&#62;, &#60;a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author"&#62;Brett&#60;/a&#62; &#38; &#60;a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author"&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<pubDate>Sun, 22 Nov 2009 23:22:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Nasser</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-6945</link>
		<dc:creator>Nasser</dc:creator>
		<pubDate>Wed, 05 Dec 2007 12:05:26 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-6945</guid>
		<description>Hi sebaa,

Have u found a NSGA-II coded in matlab with binary code</description>
		<content:encoded><![CDATA[<p>Hi sebaa,</p>
<p>Have u found a NSGA-II coded in matlab with binary code</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nasser</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-6944</link>
		<dc:creator>Nasser</dc:creator>
		<pubDate>Wed, 05 Dec 2007 11:14:21 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-6944</guid>
		<description>Thank indeed for ur help but I'm looking for NSGA-II with binary coded (representation) the one that have u sent if real vector</description>
		<content:encoded><![CDATA[<p>Thank indeed for ur help but I&#8217;m looking for NSGA-II with binary coded (representation) the one that have u sent if real vector</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1429</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Mon, 11 Jun 2007 12:28:04 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1429</guid>
		<description>File exchange to the rescue:

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=10429&#038;objectType=File</description>
		<content:encoded><![CDATA[<p>File exchange to the rescue:</p>
<p><a href="http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=10429&#038;objectType=File" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=10429&#038;objectType=File</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sebaa</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1427</link>
		<dc:creator>sebaa</dc:creator>
		<pubDate>Sat, 09 Jun 2007 12:26:20 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1427</guid>
		<description>dear sir 
do you have a NSGA-II coded in matlab with binary code 

thanks</description>
		<content:encoded><![CDATA[<p>dear sir<br />
do you have a NSGA-II coded in matlab with binary code </p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DanK</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1340</link>
		<dc:creator>DanK</dc:creator>
		<pubDate>Thu, 21 Dec 2006 14:14:30 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1340</guid>
		<description>Loren,
Thanks for the answer.  From that response it does sound like the complicated, ugly, code probably does save a lot of memory allocation, at least when you are dealing with large sets of data.

As a side note, it would be interesting if profiler had a mechanism which allowed one to know what part of an expression was using time, rather than just line by line.  I'm guessing that that is a far from simple modification, however.
Dan</description>
		<content:encoded><![CDATA[<p>Loren,<br />
Thanks for the answer.  From that response it does sound like the complicated, ugly, code probably does save a lot of memory allocation, at least when you are dealing with large sets of data.</p>
<p>As a side note, it would be interesting if profiler had a mechanism which allowed one to know what part of an expression was using time, rather than just line by line.  I&#8217;m guessing that that is a far from simple modification, however.<br />
Dan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren Shure</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1337</link>
		<dc:creator>Loren Shure</dc:creator>
		<pubDate>Wed, 20 Dec 2006 18:23:06 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1337</guid>
		<description>Dan-

With respect to temporary expressions, MATLAB cleans up or reuses the memory as it goes.  So, for example, assuming all variables and sizes are suitable for this expression


          (a+b)+(c+d)


We end up with 2 intermediate temporaries (not 3).  The temporaries start off being for the expressions in parentheses.  And when those subexpressions are added, MATLAB is smart enough to know that it can overwrite one of the temps with the final value.  So at most here, you have only one extra temporary).

There are some extra considerations that MATLAB does for expressions like


       A = A + 1;


when this is inside a function M-file.  I will be writing about that soon in one of my upcoming blog articles.

--Loren</description>
		<content:encoded><![CDATA[<p>Dan-</p>
<p>With respect to temporary expressions, MATLAB cleans up or reuses the memory as it goes.  So, for example, assuming all variables and sizes are suitable for this expression</p>
<p>          (a+b)+(c+d)</p>
<p>We end up with 2 intermediate temporaries (not 3).  The temporaries start off being for the expressions in parentheses.  And when those subexpressions are added, MATLAB is smart enough to know that it can overwrite one of the temps with the final value.  So at most here, you have only one extra temporary).</p>
<p>There are some extra considerations that MATLAB does for expressions like</p>
<p>       A = A + 1;</p>
<p>when this is inside a function M-file.  I will be writing about that soon in one of my upcoming blog articles.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DanK</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1336</link>
		<dc:creator>DanK</dc:creator>
		<pubDate>Wed, 20 Dec 2006 17:13:58 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1336</guid>
		<description>Doug,
I'm thinking mainly of the extra time required in memory allocation and handling, when you are processing large volumes of data.  What I am really unsure of here, is what memory usage MatLab makes for intermediate steps in complex computations.  Is it allocating the memory just the same as it would if we assigned each intermediate value to a variable and then clearing that allocation at the end of the computation?  If so then I would imagine you really don't lose much time.  For reference I'm thinking about processing done on arrays that are, for example 20,000x25, which can definitely chew up a bunch of memory.

Dan</description>
		<content:encoded><![CDATA[<p>Doug,<br />
I&#8217;m thinking mainly of the extra time required in memory allocation and handling, when you are processing large volumes of data.  What I am really unsure of here, is what memory usage MatLab makes for intermediate steps in complex computations.  Is it allocating the memory just the same as it would if we assigned each intermediate value to a variable and then clearing that allocation at the end of the computation?  If so then I would imagine you really don&#8217;t lose much time.  For reference I&#8217;m thinking about processing done on arrays that are, for example 20,000&#215;25, which can definitely chew up a bunch of memory.</p>
<p>Dan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1335</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Wed, 20 Dec 2006 14:29:02 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1335</guid>
		<description>Dan and Nick,

There are times when cryptic code code does give faster results.  The profiler, as outlined in an earlier video helps to diagnose that.  However, I think that sloppy code, like the kind in my original file, is rarely faster, simply harder to understand.  Even if the clearer code were slower, the ease of understanding would outweigh most small performance gains in most situations. 

That being said, I think it is worth adding another video at the end to compare the two.  My instinct is that their will be negligible difference in speed.

Doug</description>
		<content:encoded><![CDATA[<p>Dan and Nick,</p>
<p>There are times when cryptic code code does give faster results.  The profiler, as outlined in an earlier video helps to diagnose that.  However, I think that sloppy code, like the kind in my original file, is rarely faster, simply harder to understand.  Even if the clearer code were slower, the ease of understanding would outweigh most small performance gains in most situations. </p>
<p>That being said, I think it is worth adding another video at the end to compare the two.  My instinct is that their will be negligible difference in speed.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DanK</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1334</link>
		<dc:creator>DanK</dc:creator>
		<pubDate>Mon, 18 Dec 2006 18:14:17 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1334</guid>
		<description>I have the same question as Nick.  My solution has generally been to write the complicated code, and then provide the "simple" code as a comment, so that I don't have to give up speed.  I also wonder about the merits of cluttering up the variable name space... Is this yet another case, "there is never really one size that fits all"?</description>
		<content:encoded><![CDATA[<p>I have the same question as Nick.  My solution has generally been to write the complicated code, and then provide the &#8220;simple&#8221; code as a comment, so that I don&#8217;t have to give up speed.  I also wonder about the merits of cluttering up the variable name space&#8230; Is this yet another case, &#8220;there is never really one size that fits all&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Cheilakos</title>
		<link>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1330</link>
		<dc:creator>Nick Cheilakos</dc:creator>
		<pubDate>Sun, 17 Dec 2006 04:37:25 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2006/12/13/cleaner-code-in-matlab-part-1-of-series/#comment-1330</guid>
		<description>We have  a mess code but is efficient an we have a clean code but loses in speed. Which code we prefer?

In your example which code is faster? The first or the clean version?

ps: I know, that if we have clean code we can do debugging very easy.But i dont know if sometimes we earn something else</description>
		<content:encoded><![CDATA[<p>We have  a mess code but is efficient an we have a clean code but loses in speed. Which code we prefer?</p>
<p>In your example which code is faster? The first or the clean version?</p>
<p>ps: I know, that if we have clean code we can do debugging very easy.But i dont know if sometimes we earn something else</p>
]]></content:encoded>
	</item>
</channel>
</rss>
