<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.1" --><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>File Exchange Pick of the Week</title>
	<link>http://blogs.mathworks.com/pick</link>
	<description>&lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=969735&amp;objectType=author"&gt;Bob&lt;/a&gt;, &lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&amp;objectType=author"&gt;Brett&lt;/a&gt; &amp; &lt;a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&amp;objectType=author"&gt;Jiro&lt;/a&gt; share favorite user-contributed submissions from the File Exchange.</description>
	<pubDate>Fri, 06 Nov 2009 13:58:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Segmenting Coins…a Tutorial on Blob Analysis</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/Is0CxozWfrI/</link>
		<comments>http://blogs.mathworks.com/pick/2009/11/06/segmenting-coinsa-tutorial-on-blob-analysis/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 13:58:14 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/11/06/segmenting-coinsa-tutorial-on-blob-analysis/</guid>
		<description><![CDATA[
   
   Many of us who have used or participated in comp.soft-sys.matlab over the years--particularly those of us who have had occasion to solve image processing problems--have come to appreciate
      Image Analyst's thoughts on relevant matters.
   
   Recently, Image Analyst had occasion [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction></introduction>
   <p>Many of us who have used or participated in <a href="http://www.mathworks.com/matlabcentral/newsreader/">comp.soft-sys.matlab</a> over the years--particularly those of us who have had occasion to solve image processing problems--have come to appreciate
      <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/31862">Image Analyst</a>'s thoughts on relevant matters.
   </p>
   <p>Recently, Image Analyst had occasion to share his first file through the File Exchange--a <a href="http://www.mathworks.com/matlabcentral/fileexchange/25157">demo tutorial on blob analysis</a>. In a nice, well-documented bit of code, IA steps us through an approach to segmenting, and determining the properties of,
      some objects in an image. In this case, the image is a sample ('coins.png') that ships with the <a href="http://www.mathworks.com/products/image/">Image Processing Toolbox</a>.
   </p>
   <p>IA's code shows how one might segment objects of interest (coins) from the background, then use <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/images/regionprops.html"><tt>regionprops</tt></a> (my favorite IPT function!) to differentiate nickels from dimes, and dull dimes from shiny ones:
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/../images/pick/blobsdemo.png"> </p>
   <p>This is a nice demo--very informative, and certainly worth a read. Two thoughts: 1) IA's code uses <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/images/bwlabel.html"><tt>bwlabel</tt></a> to calculate a connected components matrix of the image as a precursor to calling <tt>regionprops</tt>. As of R2009a, the new IPT function <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/images/bwconncomp.html"><tt>bwconncomp</tt></a> replaces <tt>bwlabel</tt> as the preferred approach; it uses significantly less memory, and can be markedly faster! Also, 2) IA shows how one can extract
      the specific pixels (PixelIdxList) associated with each object of interest, then calculate statistics on those pixel intensities
      to differentiate shiny from dull objects. Note that the fourth syntax of <tt>regionprops</tt> in the documentation enables one to avoid this step, and instead to operate directly on the original intensity image. Using
      this syntax, one can calculate directly the MIN, MAX, or MEAN intensitities--or even the weighted centroids-- of each blob
      in the image.
   </p>
   <p>Nice work, Image Analyst!</p>
   <p><a href="http://blogs.mathworks.com/pick/?p=2493#respond">Comments?</a></p><script language="JavaScript">
<!--

    function grabCode_7a225168421d45409cc96a1d89ff7009() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='7a225168421d45409cc96a1d89ff7009 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 7a225168421d45409cc96a1d89ff7009';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_7a225168421d45409cc96a1d89ff7009()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.9<br /></p>
</div>
<!--
7a225168421d45409cc96a1d89ff7009 ##### SOURCE BEGIN #####
%% Segmenting Coins...a Tutorial on Blob Analysis
%%
% Many of us who have used or participated in <http://www.mathworks.com/matlabcentral/newsreader/ comp.soft-sys.matlab> over the
% yearsREPLACE_WITH_DASH_DASHparticularly those of us who have had occasion to solve image
% processing problemsREPLACE_WITH_DASH_DASHhave come to appreciate <http://www.mathworks.com/matlabcentral/fileexchange/authors/31862 Image Analyst>'s thoughts on
% relevant matters. 

%%
% Recently, Image Analyst had occasion to share his first file through the
% File ExchangeREPLACE_WITH_DASH_DASHa <http://www.mathworks.com/matlabcentral/fileexchange/25157 demo tutorial on blob analysis>. In a nice,
% well-documented bit of code, IA steps us through an approach to
% segmenting, and determining the properties of, some objects in an image.
% In this case, the image is a sample ('coins.png') that ships with the 
% <http://www.mathworks.com/products/image/ Image Processing Toolbox>. 

%% 
% IA's code shows how one might segment objects of interest (coins) from
% the background, then use <http://www.mathworks.com/access/helpdesk/help/toolbox/images/regionprops.html |regionprops|> (my favorite IPT function!) to differentiate
% nickels from dimes, and dull dimes from shiny ones:
%
%%
% 
% <<BlobsDemo.png>>
% 
%%
% This is a nice demoREPLACE_WITH_DASH_DASHvery informative, and certainly worth a read. Two
% thoughts: 1) IA's code uses <http://www.mathworks.com/access/helpdesk/help/toolbox/images/bwlabel.html |bwlabel|> to calculate a connected components
% matrix of the image as a precursor to calling |regionprops|. As of
% R2009a, the new IPT function <http://www.mathworks.com/access/helpdesk/help/toolbox/images/bwconncomp.html |bwconncomp|> replaces |bwlabel| as the
% preferred approach; it uses significantly less memory, and can be
% markedly faster! Also, 2) IA shows how one can extract the specific
% pixels (PixelIdxList) associated with each object of interest, then
% calculate statistics on those pixel intensities to differentiate shiny
% from dull objects. Note that the fourth syntax of |regionprops| in the documentation enables
% one to avoid this step, and instead to operate directly on the original
% intensity image. Using this syntax, one can calculate directly the MIN,
% MAX, or MEAN intensititiesREPLACE_WITH_DASH_DASHor even the weighted centroidsREPLACE_WITH_DASH_DASH of each blob
% in the image.
%%
% Nice work, Image Analyst!
%
% <http://blogs.mathworks.com/pick/?p=2493#respond Comments?>
##### SOURCE END ##### 7a225168421d45409cc96a1d89ff7009
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/Is0CxozWfrI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/11/06/segmenting-coinsa-tutorial-on-blob-analysis/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/11/06/segmenting-coinsa-tutorial-on-blob-analysis/</feedburner:origLink></item>
		<item>
		<title>allstats</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/WmClTTCb7mc/</link>
		<comments>http://blogs.mathworks.com/pick/2009/10/30/allstats/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 14:42:51 +0000</pubDate>
		<dc:creator>Bob</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/10/30/allstats/</guid>
		<description><![CDATA[
   
      Bob's pick this week is Allstats  by Francisco de Castro.
      
   
   The file is simple enough. Given a data set,x = randn(1000,1);
hist(x,100) allstats returns a list of statistical values.
   myStats = allstats(x)myStats = [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction>
      <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/5021">Bob</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/25572-allstats">Allstats</a>  by Francisco de Castro.
      </p>
   </introduction>
   <p>The file is simple enough. Given a data set,</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">x = randn(1000,1);
hist(x,100)</pre><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/pickallstats_01.png"> <p><tt>allstats</tt> returns a list of statistical values.
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">myStats = allstats(x)</pre><pre style="font-style:oblique">myStats = 
      min: -3.1289
      max: 2.9371
     mean: -0.06815
      std: 1.0019
     mode: -3.1289
     q2p5: -1.9519
       q5: -1.7128
      q25: -0.73464
      q50: -0.072006
      q75: 0.55077
      q95: 1.6351
    q97p5: 1.8844
</pre><p>The mean should be close to zero,</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">myStats.mean</pre><pre style="font-style:oblique">ans =
     -0.06815
</pre><p>and the standard deviation should be close to one.</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">myStats.std</pre><pre style="font-style:oblique">ans =
       1.0019
</pre><p>How convenient.</p>
   <p>As it turns out, this month the File Exchange recently celebrated a major milestone. <a href="http://www.mathworks.com/matlabcentral/fileexchange/25572-allstats">Allstats</a> has the honor of being the official 10,000-th submission. Congratulations to Francisco and every contributor who made this
      possible! Growth of the File Exchange has been absolutely amazing.
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/fxgrowth.png"> </p>
   <p>If only my retirement account was that impressive! (sigh)</p>
   <p><a href="http://blogs.mathworks.com/pick/?p=2486#respond">Comments?</a></p><script language="JavaScript">
<!--

    function grabCode_dcb967a0e4f64bc0a4cb6315e3f64178() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='dcb967a0e4f64bc0a4cb6315e3f64178 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' dcb967a0e4f64bc0a4cb6315e3f64178';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Robert Bemis';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_dcb967a0e4f64bc0a4cb6315e3f64178()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.9<br /></p>
</div>
<!--
dcb967a0e4f64bc0a4cb6315e3f64178 ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/5021 Bob>'s 
% pick this week is 
% <http://www.mathworks.com/matlabcentral/fileexchange/25572-allstats Allstats> 
%  by Francisco de Castro.
%%
% The file is simple enough. Given a data set,
x = randn(1000,1);
hist(x,100)
%%
% |allstats| returns a list of statistical values.
myStats = allstats(x)
%%
% The mean should be close to zero,
myStats.mean
%%
% and the standard deviation should be close to one.
myStats.std
%%
% How convenient.
%%
% As it turns out, this month the File Exchange recently celebrated a major
% milestone. 
% <http://www.mathworks.com/matlabcentral/fileexchange/25572-allstats Allstats> 
% has the honor of being the official 10,000-th submission. Congratulations
% to Francisco and every contributor who made this possible! Growth of the
% File Exchange has been absolutely amazing. 
%%
% <<../images/pick/fxgrowth.png>>
%%
% If only my retirement account was that impressive! (sigh)
%%
% <http://blogs.mathworks.com/pick/?p=2486#respond Comments?>

##### SOURCE END ##### dcb967a0e4f64bc0a4cb6315e3f64178
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/WmClTTCb7mc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/10/30/allstats/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/10/30/allstats/</feedburner:origLink></item>
		<item>
		<title>Object Oriented Programming (MATLAB vs others)</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/cGZWrKXMbSY/</link>
		<comments>http://blogs.mathworks.com/pick/2009/10/23/object-oriented-programming-matlab-vs-others/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:01:49 +0000</pubDate>
		<dc:creator>jiro</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/10/23/object-oriented-programming-matlab-vs-others/</guid>
		<description><![CDATA[
   Jiro's pick this week is "Comparison of object oriented code" by our very own Stuart McGarrity.
   
   To some of you, this may be old news, but I know that not everyone is up to date on newer features. The new Object Oriented
      [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/18972-comparison-of-c-java-python-ruby-and-matlab-using-object-oriented-example">"Comparison of object oriented code"</a> by our very own <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/2962">Stuart McGarrity</a>.
   </p>
   <p>To some of you, this may be old news, but I know that not everyone is up to date on newer features. The new Object Oriented
      Programming capability that was introduced in R2008a has been highlighted several times by <a href="http://blogs.mathworks.com/loren/2008/08/18/when-to-create-classes-in-matlab/">Loren</a>, <a href="http://blogs.mathworks.com/videos/2008/07/07/advanced-matlab-class-system-for-oop-in-matlab-introduction/">Doug</a>, and <a href="http://blogs.mathworks.com/steve/2008/03/21/matlab-76-r2008a/">Steve</a>.
   </p>
   <p>This entry by Stuart provides a nice syntax comparisons between MATLAB and a few of the common object oriented languages (C++,
      Java, Python, Ruby). Take a look at the <a href="http://www.mathworks.com/matlabcentral/fx_files/18972/12/content/Description.html">published HTML</a> to read about it and get a quick side-by-side comparison of these languages.
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/codecompare.png"> </p>
   <p><i>Note: as Stuart mentions in the comments, this is a syntax comparison, and it is not meant for showcasing best practices.
         The <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/ug_intropage.html">documentation</a> is a good place to get such info.</i></p>
   <p><a href="http://blogs.mathworks.com/pick/?p=2485#respond">Comments</a>?
   </p><script language="JavaScript">
<!--

    function grabCode_dfd1458cbd9c42a6970acdc0831b41f7() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='dfd1458cbd9c42a6970acdc0831b41f7 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' dfd1458cbd9c42a6970acdc0831b41f7';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Jiro Doke';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_dfd1458cbd9c42a6970acdc0831b41f7()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.9<br /></p>
</div>
<!--
dfd1458cbd9c42a6970acdc0831b41f7 ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/18972-comparison-of-c-java-python-ruby-and-matlab-using-object-oriented-example
% "Comparison of object oriented code"> by our very own
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/2962
% Stuart McGarrity>.
%
% To some of you, this may be old news, but I know that not everyone is up
% to date on newer features. The new Object Oriented Programming
% capability that was introduced in R2008a has been highlighted several
% times by
% <http://blogs.mathworks.com/loren/2008/08/18/when-to-create-classes-in-matlab/
% Loren>,
% <http://blogs.mathworks.com/videos/2008/07/07/advanced-matlab-class-system-for-oop-in-matlab-introduction/
% Doug>, and <http://blogs.mathworks.com/steve/2008/03/21/matlab-76-r2008a/
% Steve>.
%
% This entry by Stuart provides a nice syntax comparisons between MATLAB
% and a few of the common object oriented languages (C++, Java, Python,
% Ruby). Take a look at the <http://www.mathworks.com/matlabcentral/fx_files/18972/12/content/Description.html 
% published HTML> to read about it and get a quick side-by-side comparison
% of these languages.
%
% <<codecompare.png>>
%
% _Note: as Stuart mentions in the comments, this is a syntax comparison,
% and it is not meant for showcasing best practices. The <http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/ug_intropage.html 
% documentation> is a good place to get such info._
%
% <http://blogs.mathworks.com/pick/?p=2485#respond Comments>?
##### SOURCE END ##### dfd1458cbd9c42a6970acdc0831b41f7
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/cGZWrKXMbSY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/10/23/object-oriented-programming-matlab-vs-others/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/10/23/object-oriented-programming-matlab-vs-others/</feedburner:origLink></item>
		<item>
		<title>Circular Statistics Toolbox (Directional Statistics)</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/zZQmyJH62s8/</link>
		<comments>http://blogs.mathworks.com/pick/2009/10/16/circular-statistics-toolbox-directional-statistics/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 11:04:45 +0000</pubDate>
		<dc:creator>Bob</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/10/16/circular-statistics-toolbox-directional-statistics/</guid>
		<description><![CDATA[
   
      Bob's pick this week is Circular Statistics Toolbox (Directional Statistics) by Philipp Berens.
      
   
   I remember lots of A-ha moments in college when I realized the significance of yet another application for Fourier transforms.
   [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction>
      <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/5021">Bob</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/10676-circular-statistics-toolbox-directional-statistics">Circular Statistics Toolbox (Directional Statistics)</a> by Philipp Berens.
      </p>
   </introduction>
   <p>I remember lots of A-ha moments in college when I realized the significance of yet another application for Fourier transforms.
      For example, calculation of power spectral density in signal processing. The central limit theorem was another pleasant surprise.
      This submission stirred those memories: not unlike bumping into an old friend you haven't seen for a long time. Now all I
      need is a compelling problem that requires circular or directional statistics so I can truly internalize the value of these
      tools for myself.
   </p>
   <p>Philipp first submitted this file in January 2007. There have been a number of review comments over the years. It is currently
      rated 4.4 (on the 5 point scale).
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/circstatsfeedback.png"> </p>
   <p>Downloads have averaged almost 9 per day over the past month as well. So others clearly appreciate it. I also appreciate that
      Philipp recently updated the submission in response to feedback from others. In addition, follow the Acknowledgements trail
      to see that <a href="http://www.mathworks.com/matlabcentral/fileexchange/10676-circular-statistics-toolbox-directional-statistics">Circular Statistics Toolbox (Directional Statistics)</a> was inspired by <a href="http://www.mathworks.com/matlabcentral/fileexchange/4810-circular-cross-correlation">Circular Cross Correlation</a> which also inspired <a href="http://www.mathworks.com/matlabcentral/fileexchange/24342">Fast Circular (Periodic) Cross Correlation</a>. That's social computing. Keep up the great work, everyone.
   </p>
   <p><a href="http://blogs.mathworks.com/pick/?p=2482#respond">Comments?</a></p><script language="JavaScript">
<!--

    function grabCode_61e78d395d114a938862968e6cc1b245() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='61e78d395d114a938862968e6cc1b245 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 61e78d395d114a938862968e6cc1b245';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Robert Bemis';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_61e78d395d114a938862968e6cc1b245()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.9<br /></p>
</div>
<!--
61e78d395d114a938862968e6cc1b245 ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/5021 Bob>'s 
% pick this week is 
% <http://www.mathworks.com/matlabcentral/fileexchange/10676-circular-statistics-toolbox-directional-statistics Circular Statistics Toolbox (Directional Statistics)> 
% by Philipp Berens.
%%
% I remember lots of A-ha moments in college when I realized the significance
% of yet another application for Fourier transforms. For example, calculation
% of power spectral density in signal processing. The central limit theorem
% was another pleasant surprise. This submission stirred those memories: not
% unlike bumping into an old friend you haven't seen for a long time. Now all
% I need is a compelling problem that requires circular or directional
% statistics so I can truly internalize the value of these tools for myself.
%%
% Philipp first submitted this file in January 2007. There have been a number
% of review comments over the years. It is currently rated 4.4 (on the 5 point
% scale). 
%%
% <<..\images\pick\circstatsfeedback.png>>
%%
% Downloads have averaged almost 9 per day over the past month as well. So
% others clearly appreciate it. I also appreciate that Philipp recently
% updated the submission in response to feedback from others. In addition,
% follow the Acknowledgements trail to see that 
% <http://www.mathworks.com/matlabcentral/fileexchange/10676-circular-statistics-toolbox-directional-statistics Circular Statistics Toolbox (Directional Statistics)>
% was inspired by 
% <http://www.mathworks.com/matlabcentral/fileexchange/4810-circular-cross-correlation Circular Cross Correlation>
% which also inspired
% <http://www.mathworks.com/matlabcentral/fileexchange/24342 Fast Circular (Periodic) Cross Correlation>.
% That's social computing. Keep up the great work, everyone.
%%
% <http://blogs.mathworks.com/pick/?p=2482#respond Comments?>

##### SOURCE END ##### 61e78d395d114a938862968e6cc1b245
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/zZQmyJH62s8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/10/16/circular-statistics-toolbox-directional-statistics/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/10/16/circular-statistics-toolbox-directional-statistics/</feedburner:origLink></item>
		<item>
		<title>Colored Area on a Curved Surface</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/-BcqmsbaRko/</link>
		<comments>http://blogs.mathworks.com/pick/2009/10/09/colored-area-on-a-curved-surface/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 13:32:51 +0000</pubDate>
		<dc:creator>Bob</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/10/09/colored-area-on-a-curved-surface/</guid>
		<description><![CDATA[
   
      Bob's pick this week is Colored Area on a Curved Surface by Michael Wunder.
      
   
   This is a nice example of quantitative image analysis. Given a heat map and region of interest based on elevation,
  [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction>
      <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/5021">Bob</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/5726">Colored Area on a Curved Surface</a> by Michael Wunder.
      </p>
   </introduction>
   <p>This is a nice example of quantitative image analysis. Given a heat map and region of interest based on elevation,</p>
   <p><img vspace="5" hspace="5" src="http://www.mathworks.com/matlabcentral/fx_files/5726/1/content/ColorArea_01.png"> </p>
   <p>compute the surface area.</p>
   <p><img vspace="5" hspace="5" src="http://www.mathworks.com/matlabcentral/fx_files/5726/1/content/ColorArea_04.png"> </p>
   <p>See Michael's <a href="http://www.mathworks.com/matlabcentral/fx_files/5726/1/content/ColorArea.html">published example</a> for the step by step details.
   </p>
   <p><a href="http://blogs.mathworks.com/pick/?p=2481#respond">Comments?</a></p><script language="JavaScript">
<!--

    function grabCode_7be60f4bcbf44dd182682bc6f822bcd7() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='7be60f4bcbf44dd182682bc6f822bcd7 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 7be60f4bcbf44dd182682bc6f822bcd7';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Robert Bemis';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_7be60f4bcbf44dd182682bc6f822bcd7()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.10<br /></p>
</div>
<!--
7be60f4bcbf44dd182682bc6f822bcd7 ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/5021 Bob>'s 
% pick this week is 
% <http://www.mathworks.com/matlabcentral/fileexchange/5726 Colored Area on a Curved Surface> 
% by Michael Wunder.
%%
% This is a nice example of quantitative image analysis. Given a heat map and
% region of interest based on elevation, 
%%
% http://www.mathworks.com/matlabcentral/fx_files/5726/1/content/ColorArea_01.png
%%
% compute the surface area. 
%%
% http://www.mathworks.com/matlabcentral/fx_files/5726/1/content/ColorArea_04.png
%%
% See Michael's 
% <http://www.mathworks.com/matlabcentral/fx_files/5726/1/content/ColorArea.html published example>
% for the step by step details.
%%
% <http://blogs.mathworks.com/pick/?p=2481#respond Comments?>

##### SOURCE END ##### 7be60f4bcbf44dd182682bc6f822bcd7
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/-BcqmsbaRko" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/10/09/colored-area-on-a-curved-surface/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/10/09/colored-area-on-a-curved-surface/</feedburner:origLink></item>
		<item>
		<title>Integrating the File Exchange with the MATLAB Desktop</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/ak2h-qApTf4/</link>
		<comments>http://blogs.mathworks.com/pick/2009/10/02/integrating-the-file-exchange-with-the-matlab-desktop/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 13:57:38 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/10/02/integrating-the-file-exchange-with-the-matlab-desktop/</guid>
		<description><![CDATA[
   
      This week's Pick of the Week takes a turn "out of the box"; rather than select a file, I'd like to highlight new functionality
         in MATLAB that allows one to interface with the MATLAB Central File Exchange directly [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction>
      <p>This week's Pick of the Week takes a turn "out of the box"; rather than select a file, I'd like to highlight new functionality
         in MATLAB that allows one to interface with the MATLAB Central File Exchange directly from one's <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f1-137804.html#f1-131542">MATLAB Desktop</a>.
      </p>
   </introduction>
   <p>As of the current release of MATLAB (R2009b), the Desktop includes a new tool called, appropriately, the <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/rn/br5ktrh-1.html#br5ten7-1">File Exchange Desktop Tool</a>. To access the tool, simply browse from the MATLAB 'Start' button to 'Desktop Tools,' and then to 'File Exchange':
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/../images/pick/menuaccess.png"> </p>
   <p>From there, you'll be presented with a standard MATLAB window that will allow you to find and grab files from the Exchange.</p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/../images/pick/fexdesktoptool.png"> </p>
   <p>Also, be sure to check out this <a href="http://www.mathworks.com/support/2009b/matlab/7.9/demos/new-matlab-file-exchange-access-features-in-r2009b.html">mini video tutorial</a> demonstrating these new capabilities. And be sure to <a href="http://blogs.mathworks.com/pick/?p=2471#respond">tell us what you think!</a></p><script language="JavaScript">
<!--

    function grabCode_773bd5e2d79144cdb0b975c7b9ef7178() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='773bd5e2d79144cdb0b975c7b9ef7178 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 773bd5e2d79144cdb0b975c7b9ef7178';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_773bd5e2d79144cdb0b975c7b9ef7178()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.9<br /></p>
</div>
<!--
773bd5e2d79144cdb0b975c7b9ef7178 ##### SOURCE BEGIN #####
%% Integrating the File Exchange with the MATLAB Desktop
% This week's Pick of the Week takes a turn "out of the box"; rather than
% select a file, I'd like to highlight new functionality in MATLAB that
% allows one to interface with the MATLAB Central File Exchange directly
% from one's <http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f1-137804.html#f1-131542 MATLAB Desktop>.

%%
% As of the current release of MATLAB (R2009b), the Desktop includes a new
% tool called, appropriately, the
% <http://www.mathworks.com/access/helpdesk/help/techdoc/rn/br5ktrh-1.html#br5ten7-1 File Exchange Desktop Tool>. 
% To access the tool, simply browse from the MATLAB 'Start' button to
% 'Desktop Tools,' and then to 'File Exchange':
%%
% 
% <<menuAccess.png>>
% 
%%
% From there, you'll be presented with a standard MATLAB window that will allow you to find and grab files from the Exchange.
%%
% 
% <<fexDesktopTool.png>>
% 
%%
% Also, be sure to check out this <http://www.mathworks.com/support/2009b/matlab/7.9/demos/new-matlab-file-exchange-access-features-in-r2009b.html mini video tutorial> 
% demonstrating these new capabilities. And be sure to
% <http://blogs.mathworks.com/pick/?p=2471#respond tell us what you think!>
##### SOURCE END ##### 773bd5e2d79144cdb0b975c7b9ef7178
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/ak2h-qApTf4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/10/02/integrating-the-file-exchange-with-the-matlab-desktop/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/10/02/integrating-the-file-exchange-with-the-matlab-desktop/</feedburner:origLink></item>
		<item>
		<title>lasso.m</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/86TtHHO2BfE/</link>
		<comments>http://blogs.mathworks.com/pick/2009/09/25/lassom/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 11:51:36 +0000</pubDate>
		<dc:creator>Bob</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/09/25/lassom/</guid>
		<description><![CDATA[
   
      Bob's pick this week is lasso.m by Thomas Rutten.
      
   
   Suppose you have a set of XY points. You plot them to see how they spread out. You decide a certain clump of points is special.
 [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction>
      <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/5021">Bob</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/3991">lasso.m</a> by Thomas Rutten.
      </p>
   </introduction>
   <p>Suppose you have a set of XY points. You plot them to see how they spread out. You decide a certain clump of points is special.
      How do you get MATLAB to know which points you care about? With <tt>lasso</tt> you can select them with your mouse!
   </p>
   <p>To demonstrate I will use the sunspot example data that ships with MATLAB.</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">load <span style="color: #A020F0">sunspot.dat</span>
[x,y,i] = lasso(sunspot(:,1),sunspot(:,2))</pre><pre style="font-style:oblique">press a KEY to start selection by mouse, LEFT mouse button for selection, RIGHT button closes loop
x =
        1836
        1837
        1848
        1870
y =
        121.5
        138.3
        124.7
          139
i =
   137
   138
   149
   171
</pre><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/pick_lasso_01.png"> <img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/pick_lasso_02.png"> <pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">centroid = [mean(x) mean(y)]</pre><pre style="font-style:oblique">centroid =
       1847.8       130.88
</pre><p>The program prompted me how to start and stop the selection. I left off the semicolon to show the values returned for further
      analysis (ie, centroid calculation). The first plot shows the polygon region I selected. The second plot shows the selected
      points with a free legend and point counter. Nice!
   </p>
   <p>Note: if you like graphically interacting with your XY points be sure to check out <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/rn/brfrh4i-1.html#brfrh4i-2">Data Brushing</a> introduced with R2008a.
   </p>
   <p><a href="http://blogs.mathworks.com/pick/?p=2467#respond">Comments?</a></p><script language="JavaScript">
<!--

    function grabCode_0b99d4faa00a4756a6953e25014efb1a() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='0b99d4faa00a4756a6953e25014efb1a ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 0b99d4faa00a4756a6953e25014efb1a';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Robert Bemis';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_0b99d4faa00a4756a6953e25014efb1a()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.9<br /></p>
</div>
<!--
0b99d4faa00a4756a6953e25014efb1a ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/5021 Bob>'s 
% pick this week is 
% <http://www.mathworks.com/matlabcentral/fileexchange/3991 lasso.m> 
% by Thomas Rutten.
%%
% Suppose you have a set of XY points. You plot them to see how they spread
% out. You decide a certain clump of points is special. How do you get MATLAB
% to know which points you care about? With |lasso| you can select them with
% your mouse! 
%%
% To demonstrate I will use the sunspot example data that ships with MATLAB.
load sunspot.dat
[x,y,i] = lasso(sunspot(:,1),sunspot(:,2))
%%
centroid = [mean(x) mean(y)]
%%
% The program prompted me how to start and stop the selection. I left off the
% semicolon to show the values returned for further analysis (ie, centroid
% calculation). The first plot shows the polygon region I selected. The
% second plot shows the selected points with a free legend and point counter.
% Nice!
%%
% Note: if you like graphically interacting with your XY points be sure to
% check out 
% <http://www.mathworks.com/access/helpdesk/help/techdoc/rn/brfrh4i-1.html#brfrh4i-2 Data Brushing>
% introduced with R2008a.
%%
% <http://blogs.mathworks.com/pick/?p=2467#respond Comments?>

##### SOURCE END ##### 0b99d4faa00a4756a6953e25014efb1a
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/86TtHHO2BfE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/09/25/lassom/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/09/25/lassom/</feedburner:origLink></item>
		<item>
		<title>Easier (and less error-prone) creation of Zip files</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/dFIPpiGs8zw/</link>
		<comments>http://blogs.mathworks.com/pick/2009/09/18/easier-and-less-error-prone-creation-of-zip-files/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 14:21:19 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/09/18/easier-and-less-error-prone-creation-of-zip-files/</guid>
		<description><![CDATA[
   
      Brett's Pick this week is exportToZip, by fellow MathWorker Malcolm Wood.
      
   
   I recently received an email from a File Exchange user informing me that a GUI I had shared for morphologically processing
    [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction>
      <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/10702"><tt>exportToZip</tt></a>, by fellow MathWorker <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/21286">Malcolm Wood</a>.
      </p>
   </introduction>
   <p>I recently received an email from a File Exchange user informing me that a GUI I had shared for morphologically processing
      images (i.e., <a href="http://www.mathworks.com/matlabcentral/fileexchange/23697"><tt>morphTool</tt></a>) didn't work. As it turns out, I had neglected to include in the Zip file that I uploaded a couple of functions that were
      called internally by <tt>morphTool</tt>.
   </p>
   <p>I've made the same mistake before, and I've also downloaded File Exchange files that were missing some key functionality.</p>
   <p>This email exchange had me thinking about writing a bit of code to automatically create my Zip files, making sure to include
      all necessary supporting function files. MATLAB has a <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/depfun.html"><tt>depfun</tt></a> command that will <i>thoroughly</i> analyze a function and determine its dependencies, including, by default, functions in MATLAB Toolboxes. It can take a little
      while to generate a report, though, and does a lot more work than is necessary just to create a comprehensive Zip file. Alternatively,
      one can easily <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/rn/f3-998197.html#f3-1007592">create a dependency report</a> for the current file active in the MATLAB editor by using "Save and Show Dependency Report" from the Tools menu. That approach
      is much faster than using <tt>depfun</tt> (with its default options), but leaves you then to manually evaluate one-by-one each function that your top-level function
      calls. As you might guess, it's easy to miss a necessary file when you create your Zip.
   </p>
   <p>Before I started coding, I thought I'd check the File Exchange (wouldn't you?), and I quickly found Malcolm's <tt>exportToZip</tt>. Malcolm's file uses his own version of <tt>depfun</tt> (called <tt>mydepfun</tt>), that smartly uses non-default behavior of <tt>depfun</tt> to automatically skip files in MATLAB Toolboxes; <tt>mydepfun</tt> returns the paths to just those files needed for the target Zip file, which is then automatically created.
   </p>
   <p>I tried <tt>exportToZip</tt> on <tt>morphTool</tt>; it worked flawlessly--and quickly! And syntactically, it couldn't be easier to use:
   </p>
   <p><tt>zipfilename = exportToZip(funcname,zipfilename)</tt></p>
   <p>Oh, and incidentally, a new version of <tt>morphTool</tt> will go live soon. Thanks, Malcolm--you saved me a lot of time and effort!
   </p>
   <p>You gotta love the File Exchange!</p>
   <p><a href="http://blogs.mathworks.com/pick/?p=2465#respond">Comments?</a></p><script language="JavaScript">
<!--

    function grabCode_dbc53bc2eb94469eb54a9fc2b703639c() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='dbc53bc2eb94469eb54a9fc2b703639c ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' dbc53bc2eb94469eb54a9fc2b703639c';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_dbc53bc2eb94469eb54a9fc2b703639c()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.8<br /></p>
</div>
<!--
dbc53bc2eb94469eb54a9fc2b703639c ##### SOURCE BEGIN #####
%% Easier (and less error-prone) creation of Zip files
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett>'s
% Pick this week is <http://www.mathworks.com/matlabcentral/fileexchange/10702 |exportToZip|>,
% by fellow MathWorker <http://www.mathworks.com/matlabcentral/fileexchange/authors/21286 Malcolm Wood>.

%%
% I recently received an email from a File Exchange user informing me that a GUI I
% had shared for morphologically processing images (i.e., <http://www.mathworks.com/matlabcentral/fileexchange/23697 |morphTool|>) didn't work.
% As it turns out, I had neglected to 
% include in the Zip file that I uploaded a couple of functions that were called internally by |morphTool|.

%% 
% I've made the same mistake before, and I've also downloaded File Exchange files that were missing some key functionality.

%% 
% This email exchange had me thinking about writing a bit of code to
% automatically create my Zip files, making sure to include all necessary
% supporting function files. MATLAB has a <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/depfun.html |depfun|>
% command that will _thoroughly_ analyze a function and determine its dependencies,
% including, by default, functions in MATLAB Toolboxes. It can take a little while to generate a report, though, and does a lot more work than is necessary
% just to create a comprehensive Zip file. Alternatively, one can easily <http://www.mathworks.com/access/helpdesk/help/techdoc/rn/f3-998197.html#f3-1007592 create a dependency report>
% for the current file active in the MATLAB editor
% by using "Save and Show Dependency Report" from the Tools menu.
% That approach is much faster than using |depfun| (with its default options), but leaves you then to manually evaluate
% one-by-one each function that your top-level function calls. As you might
% guess, it's easy to miss a necessary file when you create your Zip.

%%
% Before I started coding, I thought I'd check the File Exchange (wouldn't you?), and I quickly found Malcolm's |exportToZip|.
% Malcolm's file uses his own version of |depfun| (called |mydepfun|), that
% smartly uses non-default behavior of |depfun| to automatically skip files
% in MATLAB Toolboxes; |mydepfun| returns the paths to just those files needed for the target
% Zip file, which is then automatically created. 

%%
% I tried |exportToZip| on |morphTool|; it worked flawlesslyREPLACE_WITH_DASH_DASHand
% quickly! And syntactically, it couldn't be easier to use:

%%
% |zipfilename = exportToZip(funcname,zipfilename)|

%%
% Oh, and incidentally, a new version of |morphTool| will go live soon.
% Thanks, MalcolmREPLACE_WITH_DASH_DASHyou saved me a lot of time and effort!

%%
% You gotta love the File Exchange!
%%
% <http://blogs.mathworks.com/pick/?p=2465#respond Comments?> 
##### SOURCE END ##### dbc53bc2eb94469eb54a9fc2b703639c
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/dFIPpiGs8zw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/09/18/easier-and-less-error-prone-creation-of-zip-files/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/09/18/easier-and-less-error-prone-creation-of-zip-files/</feedburner:origLink></item>
		<item>
		<title>Tables made easy</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/wE0TfWJyhII/</link>
		<comments>http://blogs.mathworks.com/pick/2009/09/11/tables-made-easy/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 11:49:58 +0000</pubDate>
		<dc:creator>jiro</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/09/11/tables-made-easy/</guid>
		<description><![CDATA[
   Jiro's pick this week is DataTable by Paul.
   
   MATLAB stands for MATrix LABoratory. So it's no surprise that we work with a lot of matrices. From time to time, I've wanted
      to embed a matrix in a Wiki page or an HTML [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/24766"><tt>DataTable</tt></a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/55230">Paul</a>.
   </p>
   <p>MATLAB stands for MATrix LABoratory. So it's no surprise that we work with a lot of matrices. From time to time, I've wanted
      to embed a matrix in a Wiki page or an HTML document. The problem is that it's a tedious process to create the appropriate
      markup, and it doesn't scale well for large matrices.
   </p>
   <p>Paul's <tt>DataTable</tt> class makes this extremely simple. Just create your matrix like a cell array, and convert it to the appropriate markup with
      a single command. In addition, he uses the new <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/brh2rgw.html">MATLAB Classes</a> (introduced in R2008a) to implement his class.
   </p>
   <p>Let's take a look at an example. Oh, and here is some personal info about us.</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">table         = DataTable();
table{2:4, 1} = {<span style="color: #A020F0">'Bob'</span>; <span style="color: #A020F0">'Brett'</span>; <span style="color: #A020F0">'Jiro'</span>};
table{1, 2:5} = {<span style="color: #A020F0">'Occupation'</span>, <span style="color: #0000FF">...</span>
  <span style="color: #A020F0">'MathWorker since...'</span>, <span style="color: #0000FF">...</span>
  <span style="color: #A020F0">'FEX submissions'</span>, <span style="color: #0000FF">...</span>
  <span style="color: #A020F0">'POTW posts'</span>};
table{2, 2:5} = {<span style="color: #A020F0">'Quality Engineer'</span>, <span style="color: #A020F0">'July 2001'</span>, 24, 25};
table{3, 2:5} = {<span style="color: #A020F0">'Application Engineer'</span>, <span style="color: #A020F0">'Dec 2005'</span>, 47, 27};
table{4, 2:5} = {<span style="color: #A020F0">'Application Engineer'</span>, <span style="color: #A020F0">'May 2006'</span>, 32, 23};

<span style="color: #228B22">% Center-align the text</span>
table.setColumnTextAlignment(1:5, <span style="color: #A020F0">'c'</span>)

table.toText();</pre><pre style="font-style:oblique">
|       |      Occupation      | MathWorker since... | FEX submissions | POTW posts |
|  Bob  |   Quality Engineer   |      July 2001      |       24        |     25     |
| Brett | Application Engineer |      Dec 2005       |       47        |     27     |
| Jiro  | Application Engineer |      May 2006       |       32        |     23     |

</pre><p>For HTML printing, simply call the <tt>toHTML</tt> method. You can even add table attributes!
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">table.toHTML(<span style="color: #A020F0">'tableattributes'</span>, <span style="color: #A020F0">'bgcolor="#ffcc00"'</span>);</pre><pre style="font-style:oblique">&lt;table bgcolor="#ffcc00"&gt;
&lt;tr&gt;
  &lt;td align="center"&gt;&lt;/td&gt;
  &lt;td align="center"&gt;Occupation&lt;/td&gt;
  &lt;td align="center"&gt;MathWorker since...&lt;/td&gt;
  &lt;td align="center"&gt;FEX submissions&lt;/td&gt;
  &lt;td align="center"&gt;POTW posts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td align="center"&gt;Bob&lt;/td&gt;
  &lt;td align="center"&gt;Quality Engineer&lt;/td&gt;
  &lt;td align="center"&gt;July 2001&lt;/td&gt;
  &lt;td align="center"&gt;24&lt;/td&gt;
  &lt;td align="center"&gt;25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td align="center"&gt;Brett&lt;/td&gt;
  &lt;td align="center"&gt;Application Engineer&lt;/td&gt;
  &lt;td align="center"&gt;Dec 2005&lt;/td&gt;
  &lt;td align="center"&gt;47&lt;/td&gt;
  &lt;td align="center"&gt;27&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td align="center"&gt;Jiro&lt;/td&gt;
  &lt;td align="center"&gt;Application Engineer&lt;/td&gt;
  &lt;td align="center"&gt;May 2006&lt;/td&gt;
  &lt;td align="center"&gt;32&lt;/td&gt;
  &lt;td align="center"&gt;23&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</pre><p>The above HTML markup renders to the following table:</p>
   <p>
      <table bgcolor="#ffcc00">
      <tr>
      <td align="center"></td>
      <td align="center">Occupation</td>
      <td align="center">MathWorker since...</td>
      <td align="center">FEX submissions</td>
      <td align="center">POTW posts</td>
      </tr>
      <tr>
      <td align="center">Bob</td>
      <td align="center">Quality Engineer</td>
      <td align="center">July 2001</td>
      <td align="center">24</td>
      <td align="center">25</td>
      </tr>
      <tr>
      <td align="center">Brett</td>
      <td align="center">Application Engineer</td>
      <td align="center">Dec 2005</td>
      <td align="center">47</td>
      <td align="center">27</td>
      </tr>
      <tr>
      <td align="center">Jiro</td>
      <td align="center">Application Engineer</td>
      <td align="center">May 2006</td>
      <td align="center">32</td>
      <td align="center">23</td>
      </tr>
      </table>
      
   </p>
   <p>Thanks for this very useful and well-written entry, Paul!</p>
   <p><a href="http://blogs.mathworks.com/pick/?p=2466#respond">Comments</a>?
   </p><script language="JavaScript">
<!--

    function grabCode_6e2ebc7f68264149838410d832dd1dad() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='6e2ebc7f68264149838410d832dd1dad ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 6e2ebc7f68264149838410d832dd1dad';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Jiro Doke';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_6e2ebc7f68264149838410d832dd1dad()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.9<br /></p>
</div>
<!--
6e2ebc7f68264149838410d832dd1dad ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/24766
% |DataTable|> by 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/55230
% Paul>.
%
% MATLAB stands for MATrix LABoratory. So it's no surprise that we work
% with a lot of matrices. From time to time, I've wanted to embed a matrix
% in a Wiki page or an HTML document. The problem is that it's a tedious
% process to create the appropriate markup, and it doesn't scale well for
% large matrices.
%
% Paul's |DataTable| class makes this extremely simple. Just create your
% matrix like a cell array, and convert it to the appropriate markup with a
% single command. In addition, he uses the new
% <http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/brh2rgw.html 
% MATLAB Classes> (introduced in R2008a) to implement his class.
%
% Let's take a look at an example. Oh, and here is some personal info
% about us.

table         = DataTable();
table{2:4, 1} = {'Bob'; 'Brett'; 'Jiro'};
table{1, 2:5} = {'Occupation', ...
  'MathWorker since...', ...
  'FEX submissions', ...
  'POTW posts'};
table{2, 2:5} = {'Quality Engineer', 'July 2001', 24, 25};
table{3, 2:5} = {'Application Engineer', 'Dec 2005', 47, 27};
table{4, 2:5} = {'Application Engineer', 'May 2006', 32, 23};

% Center-align the text
table.setColumnTextAlignment(1:5, 'c')

table.toText();

%%
% For HTML printing, simply call the |toHTML| method. You can even add
% table attributes!

table.toHTML('tableattributes', 'bgcolor="#ffcc00"');

%%
% The above HTML markup renders to the following table:
%
% <html>
% <table bgcolor="#ffcc00">
% <tr>
%   <td align="center"></td>
%   <td align="center">Occupation</td>
%   <td align="center">MathWorker since...</td>
%   <td align="center">FEX submissions</td>
%   <td align="center">POTW posts</td>
% </tr>
% <tr>
%   <td align="center">Bob</td>
%   <td align="center">Quality Engineer</td>
%   <td align="center">July 2001</td>
%   <td align="center">24</td>
%   <td align="center">25</td>
% </tr>
% <tr>
%   <td align="center">Brett</td>
%   <td align="center">Application Engineer</td>
%   <td align="center">Dec 2005</td>
%   <td align="center">47</td>
%   <td align="center">27</td>
% </tr>
% <tr>
%   <td align="center">Jiro</td>
%   <td align="center">Application Engineer</td>
%   <td align="center">May 2006</td>
%   <td align="center">32</td>
%   <td align="center">23</td>
% </tr>
% </table>
% </html>
%
%
% Thanks for this very useful and well-written entry, Paul!
%
% <http://blogs.mathworks.com/pick/?p=2466#respond Comments>?
##### SOURCE END ##### 6e2ebc7f68264149838410d832dd1dad
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/wE0TfWJyhII" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/09/11/tables-made-easy/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/09/11/tables-made-easy/</feedburner:origLink></item>
		<item>
		<title>Concatenate vectors of unequal lengths</title>
		<link>http://feedproxy.google.com/~r/mathworks/pick/~3/3HE6VluhiAU/</link>
		<comments>http://blogs.mathworks.com/pick/2009/09/04/concatenate-vectors-of-unequal-lengths/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 12:33:51 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
		
		<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2009/09/04/concatenate-vectors-of-unequal-lengths/</guid>
		<description><![CDATA[
   
      Brett's Pick this week is padcat, by Jos--one of the File Exchange's most popular contributors.
      
   
   MATLAB has a few containers that are useful for storing heterogeneous data. In particular, one can store just about any [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction>
      <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/22909"><tt>padcat</tt></a>, by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/10584">Jos</a>--one of the File Exchange's most popular contributors.
      </p>
   </introduction>
   <p>MATLAB has a few containers that are useful for storing heterogeneous data. In particular, one can store just about any combination
      of variables or data types in <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/cell.html">cell arrays</a>, <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/struct.html">structures</a>, or (if you have the always useful <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/stats/stats_product_page.html">Statistics Toolbox</a>) <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/stats/dataset.html">dataset arrays</a>. Sometimes you want something lighter-weight, and easy to manipulate. If you just wanted to combine several row or column
      vectors into a matrix, the function <tt>cat</tt> makes short work of it, if the vectors are the same length and orientation (all row vectors or all column vectors). If, on
      the other hand, they had the same orientation but different lengths, <tt>cat</tt> wouldn't know what to do with them.
   </p>
   <p>With <tt>padcat</tt>, you could automatically combine them, padding shorter vectors with NaNs as necessary.
   </p>
   <p>Say, for example, that you had four row vectors of different length:</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">a = 1:5 ; b = 1:3 ; c = [] ; d = 1:4 ;</pre><p>and you wanted to create from them a single matrix. Try <tt>padcat</tt>:
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">M = padcat(a,b,c,d) <span style="color: #228B22">% all are row vectors</span></pre><pre style="font-style:oblique">M =
     1     2     3     4     5
     1     2     3   NaN   NaN
   NaN   NaN   NaN   NaN   NaN
     1     2     3     4   NaN
</pre><p>As an added bonus, Jos's function can generate a second output that contains a binary mask showing <i>true</i> (or 1) where elements of M originated from an input vector, and <i>false</i> (or 0) where they were padded. This can be useful if any of the component vectors themselves contain NaNs. For instance:
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">a = [1:3]' ; b = [] ; c = [1;NaN] ;
[M,tf] = padcat(a,b,c) <span style="color: #228B22">% all are column vectors</span></pre><pre style="font-style:oblique">M =
     1   NaN     1
     2   NaN   NaN
     3   NaN   NaN
tf =
     1     0     1
     1     0     1
     1     0     0
</pre><p>(Note that the second element in the third column of <i>tf</i> [i.e., row 2, column 3] is 1, indicating that the NaN in that position of M originated in vector <i>c</i>.)
   </p>
   <p>Just a nice utility function to have around. Thanks, Jos!</p>
   <p><a href="http://blogs.mathworks.com/pick/?p=2464#respond">Comments?</a></p><script language="JavaScript">
<!--

    function grabCode_aff7cfc70d094f9ba2005072a548d460() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='aff7cfc70d094f9ba2005072a548d460 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' aff7cfc70d094f9ba2005072a548d460';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2009 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_aff7cfc70d094f9ba2005072a548d460()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.8<br /></p>
</div>
<!--
aff7cfc70d094f9ba2005072a548d460 ##### SOURCE BEGIN #####
%% Concatenate Vectors of Different Lengths
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett>'s
% Pick this week is <http://www.mathworks.com/matlabcentral/fileexchange/22909 |padcat|>,
% by <http://www.mathworks.com/matlabcentral/fileexchange/authors/10584 Jos>REPLACE_WITH_DASH_DASHone of the File Exchange's most popular contributors.

%%
% MATLAB has a few containers that are useful for storing heterogeneous
% data. In particular, one can store just about any combination of variables or data types in
% <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/cell.html cell arrays>, <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/struct.html structures>,
% or (if you have the always useful <http://www.mathworks.com/access/helpdesk/help/toolbox/stats/stats_product_page.html Statistics Toolbox>)
% <http://www.mathworks.com/access/helpdesk/help/toolbox/stats/dataset.html dataset arrays>.
% Sometimes you want something lighter-weight, and easy to manipulate. If you just wanted to combine several row or column vectors into a matrix, 
% the function |cat| makes short work of it, if the vectors are the same length and orientation (all row vectors or all column vectors).
% If, on the other hand, they had the same orientation but different lengths, |cat| wouldn't know what to do with them.

%%
% With |padcat|, you could automatically combine them, padding shorter vectors with NaNs as necessary.

%%
% Say, for example, that you had four row vectors of different length:

a = 1:5 ; b = 1:3 ; c = [] ; d = 1:4 ;

%%
% and you wanted to create from them a single matrix. Try |padcat|:

M = padcat(a,b,c,d) % all are row vectors

%%
% As an added bonus, Jos's function can generate a second output that
% contains a binary mask showing _true_ (or 1) where elements of M originated from an 
% input vector, and _false_ (or 0) where they were padded. This can be
% useful if any of the component vectors themselves contain NaNs. For
% instance:

a = [1:3]' ; b = [] ; c = [1;NaN] ;
[M,tf] = padcat(a,b,c) % all are column vectors

%%
% (Note that the second element in the third column of _tf_ [i.e., row 2, column 3] is 1,
% indicating that the NaN in that position of M originated in vector _c_.)

%%
% Just a nice utility function to have around. Thanks, Jos!
%%
% <http://blogs.mathworks.com/pick/?p=2464#respond Comments?> 
##### SOURCE END ##### aff7cfc70d094f9ba2005072a548d460
--><img src="http://feeds.feedburner.com/~r/mathworks/pick/~4/3HE6VluhiAU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2009/09/04/concatenate-vectors-of-unequal-lengths/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.mathworks.com/pick/2009/09/04/concatenate-vectors-of-unequal-lengths/</feedburner:origLink></item>
	</channel>
</rss>
